{
    "openapi": "3.0.0",
    "info": {
        "title": "人脸识别 - API文档",
        "version": "1.0.0",
        "description": "通过传递图像url或图像base64，返回人脸识别年龄、性别、脸型、颜值、表情以及是否为卡通\/真实人脸图像等十几项参数。"
    },
    "servers": [
        {
            "url": "https:\/\/apis.tianapi.com"
        }
    ],
    "paths": {
        "\/face\/index": {
            "get": {
                "summary": "人脸识别",
                "tags": [
                    "人脸识别"
                ],
                "description": "识别人脸面部信息、表情、年龄、心情状态等",
                "parameters": [
                    {
                        "name": "key",
                        "in": "query",
                        "description": "API密钥",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "description": "API密钥"
                        }
                    },
                    {
                        "name": "image",
                        "in": "query",
                        "description": "图片base64编码或url",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "example": "https:\/\/www.tianapi.com\/static\/img\/ocr\/ldh.jpg",
                            "description": "图片base64编码或url"
                        }
                    },
                    {
                        "name": "imgtype",
                        "in": "query",
                        "description": "图片数据类型，url或base64",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "url",
                            "description": "图片数据类型，url或base64"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "成功响应",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "age": {
                                            "type": "int",
                                            "example": 22,
                                            "description": "年龄"
                                        },
                                        "race": {
                                            "type": "object",
                                            "description": "人种及可信度，0最小、1最大"
                                        },
                                        "angle": {
                                            "type": "object",
                                            "description": "人脸旋转角度参数"
                                        },
                                        "beauty": {
                                            "type": "float",
                                            "example": 72.72,
                                            "description": "颜值打分，范围0-100，越大表示越美"
                                        },
                                        "gender": {
                                            "type": "object",
                                            "description": "性别及可信度，0最小、1最大"
                                        },
                                        "emotion": {
                                            "type": "object",
                                            "description": "情绪及可信度，0最小、1最大"
                                        },
                                        "glasses": {
                                            "type": "object",
                                            "description": "是否带眼镜及可信度，0最小、1最大"
                                        },
                                        "face_num": {
                                            "type": "int",
                                            "example": 1,
                                            "description": "人脸数量"
                                        },
                                        "location": {
                                            "type": "object",
                                            "description": "人脸在图片中的位置"
                                        },
                                        "face_type": {
                                            "type": "object",
                                            "description": "真实人脸\/卡通人脸"
                                        },
                                        "expression": {
                                            "type": "object",
                                            "description": "表情及可信度，0最小、1最大"
                                        },
                                        "eye_status": {
                                            "type": "object",
                                            "description": "双眼状态（睁开\/闭合）及可能性，越接近0闭合的可能性越大"
                                        },
                                        "face_shape": {
                                            "type": "object",
                                            "description": "脸型及可信度，0最小、1最大"
                                        },
                                        "face_probability": {
                                            "type": "int",
                                            "example": 1,
                                            "description": "人脸置信度，代表这是一张人脸的概率，0最小、1最大"
                                        }
                                    }
                                },
                                "example": {
                                    "msg": "success",
                                    "code": 200,
                                    "result": {
                                        "list": [
                                            {
                                                "age": 38,
                                                "race": {
                                                    "type": "yellow",
                                                    "probability": 1
                                                },
                                                "angle": {
                                                    "yaw": -4.51,
                                                    "roll": -5.22,
                                                    "pitch": 7.33
                                                },
                                                "beauty": 47.94,
                                                "gender": {
                                                    "type": "male",
                                                    "probability": 1
                                                },
                                                "emotion": {
                                                    "type": "happy",
                                                    "probability": 0.94
                                                },
                                                "glasses": {
                                                    "type": "none",
                                                    "probability": 1
                                                },
                                                "location": {
                                                    "top": 92.14,
                                                    "left": 186.93,
                                                    "width": 98,
                                                    "height": 97,
                                                    "rotation": -3
                                                },
                                                "face_type": {
                                                    "type": "human",
                                                    "probability": 0.95
                                                },
                                                "expression": {
                                                    "type": "smile",
                                                    "probability": 0.91
                                                },
                                                "eye_status": {
                                                    "left_eye": 0.9999644756,
                                                    "right_eye": 1
                                                },
                                                "face_shape": {
                                                    "type": "oval",
                                                    "probability": 0.43
                                                },
                                                "face_probability": 1
                                            }
                                        ],
                                        "face_num": 1
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "summary": "人脸识别",
                "tags": [
                    "人脸识别"
                ],
                "description": "识别人脸面部信息、表情、年龄、心情状态等",
                "requestBody": {
                    "content": {
                        "application\/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "key": {
                                        "type": "string",
                                        "description": "API密钥"
                                    },
                                    "image": {
                                        "type": "string",
                                        "example": "https:\/\/www.tianapi.com\/static\/img\/ocr\/ldh.jpg",
                                        "description": "图片base64编码或url"
                                    },
                                    "imgtype": {
                                        "type": "string",
                                        "example": "url",
                                        "description": "图片数据类型，url或base64"
                                    }
                                },
                                "required": [
                                    "key",
                                    "image"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "成功响应",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "age": {
                                            "type": "int",
                                            "example": 22,
                                            "description": "年龄"
                                        },
                                        "race": {
                                            "type": "object",
                                            "description": "人种及可信度，0最小、1最大"
                                        },
                                        "angle": {
                                            "type": "object",
                                            "description": "人脸旋转角度参数"
                                        },
                                        "beauty": {
                                            "type": "float",
                                            "example": 72.72,
                                            "description": "颜值打分，范围0-100，越大表示越美"
                                        },
                                        "gender": {
                                            "type": "object",
                                            "description": "性别及可信度，0最小、1最大"
                                        },
                                        "emotion": {
                                            "type": "object",
                                            "description": "情绪及可信度，0最小、1最大"
                                        },
                                        "glasses": {
                                            "type": "object",
                                            "description": "是否带眼镜及可信度，0最小、1最大"
                                        },
                                        "face_num": {
                                            "type": "int",
                                            "example": 1,
                                            "description": "人脸数量"
                                        },
                                        "location": {
                                            "type": "object",
                                            "description": "人脸在图片中的位置"
                                        },
                                        "face_type": {
                                            "type": "object",
                                            "description": "真实人脸\/卡通人脸"
                                        },
                                        "expression": {
                                            "type": "object",
                                            "description": "表情及可信度，0最小、1最大"
                                        },
                                        "eye_status": {
                                            "type": "object",
                                            "description": "双眼状态（睁开\/闭合）及可能性，越接近0闭合的可能性越大"
                                        },
                                        "face_shape": {
                                            "type": "object",
                                            "description": "脸型及可信度，0最小、1最大"
                                        },
                                        "face_probability": {
                                            "type": "int",
                                            "example": 1,
                                            "description": "人脸置信度，代表这是一张人脸的概率，0最小、1最大"
                                        }
                                    }
                                },
                                "example": {
                                    "msg": "success",
                                    "code": 200,
                                    "result": {
                                        "list": [
                                            {
                                                "age": 38,
                                                "race": {
                                                    "type": "yellow",
                                                    "probability": 1
                                                },
                                                "angle": {
                                                    "yaw": -4.51,
                                                    "roll": -5.22,
                                                    "pitch": 7.33
                                                },
                                                "beauty": 47.94,
                                                "gender": {
                                                    "type": "male",
                                                    "probability": 1
                                                },
                                                "emotion": {
                                                    "type": "happy",
                                                    "probability": 0.94
                                                },
                                                "glasses": {
                                                    "type": "none",
                                                    "probability": 1
                                                },
                                                "location": {
                                                    "top": 92.14,
                                                    "left": 186.93,
                                                    "width": 98,
                                                    "height": 97,
                                                    "rotation": -3
                                                },
                                                "face_type": {
                                                    "type": "human",
                                                    "probability": 0.95
                                                },
                                                "expression": {
                                                    "type": "smile",
                                                    "probability": 0.91
                                                },
                                                "eye_status": {
                                                    "left_eye": 0.9999644756,
                                                    "right_eye": 1
                                                },
                                                "face_shape": {
                                                    "type": "oval",
                                                    "probability": 0.43
                                                },
                                                "face_probability": 1
                                            }
                                        ],
                                        "face_num": 1
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}