文档中心 > API类目 > 视觉开放API(viapi)

aliyun.viapi.facebody.detectface (人脸检测定位)

输入图片之后,在人脸检测定位返回结果的基础上,识别各个检测人脸的四种属性,返回性别(男/女)、年龄、表情(笑/不笑)、眼镜(戴/不戴);并可返回人脸的1024维深度学习特征、(参数图片/链接必须通过以下方式获取: https://help.aliyun.com/document_detail/155645.html )

公共参数

请求参数

名称 类型 是否必须 示例值 更多限制 描述
image_url String 必须 http://vigen-invi.oss-cn-shanghai.aliyuncs.com/temp/yywd/matting/0/9.png 图片url地址(http/https)
image_type Number 可选 0 0: 通过url识别,参数image_url不为空;1: 通过图片content识别,参数content不为空 支持图片格式:JPEG、JPG、BMP、PNG

响应参数

名称 类型 示例值 描述
taobao_request_id String 7E1ECC52-FD0D-4637-84A7-910C412A527F 请求ID
data Data {} 系统自动生成
  • └ face_probability_list
  • Number []
  • 1
  • 返回人脸概率, 0-1之间,如有多个人脸,则依次顺延。如有两个人脸则返回[face_prob1, face_prob2]
  • └ landmark_count
  • Number
  • 105
  • 特征点数目,目前固定为105点(顺序:眉毛24点,眼睛32点,鼻子6点,嘴巴34点,外轮廓9点)
  • └ face_rectangles
  • Number []
  • 0, 0, 0, 0
  • 返回人脸矩形框,分别是[left, top, width, height], 如有多个人脸,则依次顺延,返回矩形框。如有两个人脸则返回[left1, top1, width1, height1, left2, top2, width2, height2]
  • └ landmarks
  • String []
  • 1
  • 特征点定位结果,每个人脸返回一组特征点位置,表示方式为(x0, y0, x1, y1, ……);如有多个人脸,则依次顺延,返回定位浮点数
  • └ face_count
  • Number
  • 1
  • 检测出来的人脸个数
  • └ pose_list
  • String []
  • -2.33
  • 返回人脸姿态[yaw, pitch, roll], yaw为左右角度,取值[-90, 90],pitch为上下角度,取值[-90, 90], roll为平面旋转角度,取值[-180, 180],如有多个人脸,则依次顺延
  • └ pupils
  • String []
  • 1.32
  • 左右两个瞳孔的中心点坐标和半径,每个人脸6个浮点数,顺序是[left_iris_cenpt.x, left_iris_cenpt.y, left_iris_radius, right_iris_cenpt.x, right_iris_cenpt.y, right_iris_radis]

请求示例

  • JAVA
  • .NET
  • PHP
  • CURL
  • Python
  • C/C++
  • NodeJS
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
AliyunViapiFacebodyDetectfaceRequest req = new AliyunViapiFacebodyDetectfaceRequest();
req.setImageUrl("http://vigen-invi.oss-cn-shanghai.aliyuncs.com/temp/yywd/matting/0/9.png");
req.setImageType(0L);
AliyunViapiFacebodyDetectfaceResponse rsp = client.execute(req);
System.out.println(rsp.getBody());

响应示例

  • XML示例
  • JSON示例
<aliyun_viapi_facebody_detectface_response>
    <taobao_request_id>7E1ECC52-FD0D-4637-84A7-910C412A527F</taobao_request_id>
    <data>
        <face_probability_list>
            <number>1</number>
        </face_probability_list>
        <landmark_count>105</landmark_count>
        <face_rectangles>
            <number>0</number>
            <number>0</number>
            <number>0</number>
            <number>0</number>
        </face_rectangles>
        <landmarks>
            <string>1</string>
        </landmarks>
        <face_count>1</face_count>
        <pose_list>
            <string>-2.33</string>
        </pose_list>
        <pupils>
            <string>1.32</string>
        </pupils>
    </data>
</aliyun_viapi_facebody_detectface_response>

异常示例

  • XML示例
  • JSON示例
<error_response>
    <code>50</code>
    <msg>Remote service error</msg>
    <sub_code>isv.invalid-parameter</sub_code>
    <sub_msg>非法参数</sub_msg>
</error_response>

错误码解释

错误码 错误描述 解决方案

API工具

如何获得此API

FAQ

返回
顶部