人脸识别

最后更新于:2022-04-02 08:16:56

## 人脸识别 ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/fe/99/fe9911aac87428b8ce9906e81413a52a_200x200.png) > 返回人脸识别年龄、性别、颜值、表情等各项参数。请求参数image请传递照片url。 ## 接口费用( [点击购买](https://market.topthink.com/product/214)) > 最低 0.002元/次 ## 接口调用([调用须知](https://docs.topthink.com/think-api/1835086)) ### 请求地址 ``` GET https://api.topthink.com/ocr/face ``` ### 请求参数 | 名称 | 类型 | 必填 | 说明 | | --- | --- | --- | --- | | appCode| string| 是|用户授权码,参考[API调用](https://docs.topthink.com/think-api/1835086) | | image| string | 是 | 图片URL| ### 返回`data`参数 | 名称 | 类型 | 示例值 | 说明 | | --- | --- | --- | --- | | location | array | | 人脸在图片中的位置 | | face\_probability | int | 1 | 人脸置信度,代表这是一张人脸的概率,0最小、1最大 | | angle | array | | 人脸旋转角度参数 | | age | int | 22 | 年龄 | | beauty | float | 72.72 | 颜值打分,范围0-100,越大表示越美 | | expression | array | | 表情及可信度,0最小、1最大 | | face\_shape | array | | 脸型及可信度,0最小、1最大 | | gender | array | | 性别及可信度,0最小、1最大 | | glasses | array | | 是否带眼镜及可信度,0最小、1最大 | | race | array | | 人种及可信度,0最小、1最大 | | eye\_status | array | | 双眼状态(睁开/闭合)及可能性,越接近0闭合的可能性越大 | | emotion | array | | 情绪及可信度,0最小、1最大 | | face\_type | array | | 真实人脸/卡通人脸 | ## SDK调用 ``` $client = new Client("YourAppCode"); $result = $client->ocrFace() ->withImage('https://docs.topthink.com/think-api/1835085') ->request(); ``` 返回示例: ~~~ { "code":0, "message": "成功", "data": [ { "location":{ "left":196.18, "top":162.42, "width":189, "height":186, "rotation":-2 }, "face_probability":1, "angle":{ "yaw":-0.18, "pitch":15.95, "roll":-4.14 }, "age":22, "beauty":72.72, "expression":{ "type":"smile", "probability":1 }, "face_shape":{ "type":"heart", "probability":0.54 }, "gender":{ "type":"female", "probability":1 }, "glasses":{ "type":"none", "probability":1 }, "race":{ "type":"yellow", "probability":1 }, "eye_status":{ "left_eye":1, "right_eye":1 }, "emotion":{ "type":"happy", "probability":1 }, "face_type":{ "type":"human", "probability":0.97 } } ] } ~~~
';