人脸识别特征值同步接口
更新时间:2023-06-15
人脸识别特征值同步接口
人脸识别特征值同步接口可以实现人脸特征抽取和人脸库的构建。 该接口主要用于在服务端(云端)提取与人脸离线识别SDK通用的人脸特征值,通过调用该接口获取到的人脸特征值及构建的人脸库可以直接导入离线设备端作为人脸离线识别SDK的底库。
特征抽取接口
说明:该接口用于检测图片中的人脸并获得人脸位置信息及特征数据
1. 请求参数
1.1. 请求方法
HTTP方法:POST
请求URL: https://aip.baidubce.com/rest/2.0/face/v1/feature
URL参数:
参数 | 值 |
---|---|
access_token | 通过API Key和Secret Key获取的access_token,参考“Access Token获取” |
Header:
参数 | 值 |
---|---|
Content-Type | application/json |
1.2. 参数列表
参数 | 是否必选 | 类型 | 说明 |
---|---|---|---|
image | 是 | string | 图片信息(数据大小应小于10M) |
image_type | 是 | string | 图片类型: BASE64:图片的base64值 URL:图片的 URL( 下载图片时可能由于网络等原因导致下载图片时间过长) |
platform_version | 否 | string | 平台版本(私有化部署版本)可选值有Android_4300、Android_4501、Android_5101、Android_6001、Android_60011、Android_6002、Android_6003、Android_8001、Android_8002、HiSilicon_2000、HiSilicon_2001、Windows_8001、Windows_8002 |
version | 否 | string | 服务版本(公有云接口版本), 当前支持【4300、4501、5101、6001、60011、6002、Android_7001、Android_7002、Android_7003、Android_905D3、Android_8001、Android_8002、Windows_8001、Windows_8002、HiSilicon_2000、HiSilicon_2001、HiSilicon_2003、HiSilicon_3000、RV1109_2000、RV1109_2001、RV1109_2003、RV1109_3000】 4300对应安卓sdk的4.3.0.1版本; 4501对应安卓sdk4.5.0.1版本; 5101对应安卓sdk5.1.0.1版本; 6001: 对应安卓/Windows 6.0通行版; 60011:对应安卓6.0通行红外照版; 6002: 对应安卓/Windows 6.0口罩版; 6003:对应安卓6.0证件照识别模型; Android_7001:对应7.0通用版RGB识别模型; Android_7002:对应7.0通用版RGB&NIR识别模型; Android_7003:对应7.0海外版RGB识别模型; Android_905D3: 对应905D3 1.0 RGB识别模型; Android_8001:对应8.0通用版RGB识别模型; Android_8002:对应8.0通用版RGB&NIR识别模型; Windows_8001:对应8.0通用版RGB识别模型; Windows_8002:对应8.0通用版RGB&NIR识别模型; HiSilicon_2000:对应海思2.0通用版RGB识别模型; HiSilicon_2001:对应海思2.0通用版RGB&NIR识别模型; HiSilicon_2003:对应海思2.0海外版RGB识别模型; HiSilicon_3000:对应HiSilicon 3.0通用版RGB识别模型 RV1109_2000:对应RV1109 2.0通用版RGB识别模型; RV1109_2001:对应RV1109 2.0通用版RGB&NIR识别模型; RV1109_2003:对应RV1109 2.0海外版RGB识别模型; RV1109_3000:对应RV1109 3.0通用版RGB识别模型 备注:只有大版本号一致才能满足不同系统版本SDK的特征值互通,例如安卓6.x和Windows 6.x,新版本安卓8.x和Windows 8.x |
max_face_num | 否 | uint32 | 最多处理人脸的数目. 默认值为1(仅检测图片中面积最大的那个人脸) 最大值100 |
prob_threshold | 否 | float | 人脸检测置信度过滤阈值 范围0~1 默认值为0.5 |
min_face_size | 否 | uint32 | 人脸大小过滤阈值 默认值为50(仅检测人脸区域宽度在50以上的人脸) |
1.3. 请求示例
{
"image": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHB...",
"image_type": "BASE64",
"version": 4300
}
2.返回结果
2.1. 参数列表
字段 | 是否必选 | 类型 | 说明 |
---|---|---|---|
face_num | 是 | int | 图片中的人脸数量 |
face_list | 是 | array | 人脸信息列表 字段信息见下 |
----------------------------- | ---- | ---- | ----------------------------------------------------------------- |
location | 是 | array | 人脸在图片中的位置 |
+center_x | 是 | float | 人脸区域中心点离左边界的距离 |
+center_y | 是 | float | 人脸区域中心点离上边界的距离 |
+width | 是 | float | 人脸区域的宽度 |
+height | 是 | float | 人脸区域的高度 |
+rotation | 是 | int64 | 人脸框相对于竖直方向的顺时针旋转角,[-180,180] |
face_probability | 是 | float | 人脸置信度,范围0-1 |
landmark72 | 否 | array | 72个特征点位置 face_field包含landmark时返回 具体对应位置见72个关键点示意图 |
landmark72_probability | 是 | float | 人脸置信度,范围0-1 |
feature | 是 | string | 人脸特征信息 |
2.2. 返回示例
{
"error_code": 0,
"error_msg": "SUCCESS",
"log_id": 2858021767,
"timestamp": 1586767658,
"cached": 0,
"result": {
"face_num": 1,
"face_list": [
{
"location": {
"center_x": 77.58989716,
"center_y": 142.822937,
"width": 88.65403748,
"height": 111.686615,
"rotation": 0
},
"landmark72_probability": 0.9992024302,
"landmark72": [
{
"x": 31.85945511,
"y": 134.6939392
},
{
"x": 34.70507431,
"y": 149.3773804
},
{
"x": 38.71540833,
"y": 163.9017944
},
{
"x": 45.37094498,
"y": 178.0964508
},
{
"x": 58.14535522,
"y": 190.8776245
},
{
"x": 73.57247925,
"y": 198.5220337
},
{
"x": 88.43057251,
"y": 200.3898926
},
{
"x": 101.6749039,
"y": 194.270813
},
{
"x": 113.2898407,
"y": 181.7249756
},
{
"x": 120.3853683,
"y": 167.4402008
},
{
"x": 122.5986481,
"y": 153.5954437
},
{
"x": 123.1974487,
"y": 139.8652344
},
{
"x": 122.687851,
"y": 126.2104416
},
{
"x": 52.40658951,
"y": 135.2301331
},
{
"x": 56.85477448,
"y": 132.2627563
},
{
"x": 61.40156555,
"y": 131.2002563
},
{
"x": 65.94801331,
"y": 131.8759308
},
{
"x": 70.11144257,
"y": 135.0392303
},
{
"x": 65.93842316,
"y": 135.842926
},
{
"x": 61.48118591,
"y": 136.3649902
},
{
"x": 56.84508896,
"y": 136.0989227
},
{
"x": 61.41680908,
"y": 133.6108093
},
{
"x": 44.35185242,
"y": 125.7888184
},
{
"x": 50.08662415,
"y": 120.1439972
},
{
"x": 57.18831635,
"y": 118.5079346
},
{
"x": 64.31583405,
"y": 118.9860992
},
{
"x": 71.02742767,
"y": 122.8297577
},
{
"x": 64.24365234,
"y": 123.2055359
},
{
"x": 57.56406403,
"y": 123.3519287
},
{
"x": 50.91134644,
"y": 124.1832886
},
{
"x": 92.80820465,
"y": 132.9268494
},
{
"x": 96.26389313,
"y": 128.844574
},
{
"x": 100.5915298,
"y": 127.3882294
},
{
"x": 105.1667709,
"y": 127.6879349
},
{
"x": 109.6202545,
"y": 129.9836884
},
{
"x": 105.8541565,
"y": 131.58078
},
{
"x": 101.5338593,
"y": 132.6605225
},
{
"x": 97.05542755,
"y": 132.9283447
},
{
"x": 100.1235352,
"y": 129.9213257
},
{
"x": 90.2924881,
"y": 121.1221771
},
{
"x": 96.0561142,
"y": 116.0347748
},
{
"x": 102.5889816,
"y": 114.3559265
},
{
"x": 109.3289413,
"y": 114.6903839
},
{
"x": 115.2678986,
"y": 119.429985
},
{
"x": 109.318779,
"y": 118.7310181
},
{
"x": 103.117363,
"y": 119.074173
},
{
"x": 96.82205963,
"y": 120.2095337
},
{
"x": 76.32652283,
"y": 135.2134247
},
{
"x": 75.47886658,
"y": 142.9312134
},
{
"x": 74.66484833,
"y": 150.6994934
},
{
"x": 71.87775421,
"y": 159.0964966
},
{
"x": 78.33350372,
"y": 160.4037628
},
{
"x": 91.78503418,
"y": 159.0786133
},
{
"x": 96.69219971,
"y": 156.4392853
},
{
"x": 92.56558228,
"y": 148.8883667
},
{
"x": 90.01399231,
"y": 141.4549561
},
{
"x": 87.45940399,
"y": 134.0280151
},
{
"x": 85.36231995,
"y": 155.7476807
},
{
"x": 66.46245575,
"y": 172.3835449
},
{
"x": 76.1668396,
"y": 170.0975342
},
{
"x": 85.70652771,
"y": 169.4825439
},
{
"x": 94.3141861,
"y": 168.2900391
},
{
"x": 102.5781555,
"y": 168.4827271
},
{
"x": 96.42169952,
"y": 176.848175
},
{
"x": 86.68830109,
"y": 180.6125488
},
{
"x": 75.61171722,
"y": 179.1507874
},
{
"x": 76.39985657,
"y": 172.5153046
},
{
"x": 85.97942352,
"y": 172.4254913
},
{
"x": 94.55542755,
"y": 170.6518555
},
{
"x": 94.6856842,
"y": 173.494873
},
{
"x": 86.11052704,
"y": 175.6858673
},
{
"x": 76.53229523,
"y": 175.497345
}
],
"feature": "azwBEORLwZYRJ+YYPHcnHAFyfII8LSUEuYZtCQfWXQ5mrycxpiT2NB7fnLiiCkW9pmX8oOL+eqSUorLXysaPrMijcdDwf/lW2bmoWenMYlxPsLpAw/F5Ra6uRUkQ047NqzqS8eOqafRphSl6OGTRfDBLq2A3WkjlAcwNaHHzd+2fvPIRm9l/6+nGjJjE4qAc81CFABDR8gXGhGQJtCGLDZokDTAn+A40zIBmOE4h5DzVBzKgrixiJHKYHqoAkCisY+lcL43E+lRzZKNY+6iIXR4qckRV8qxF7TOXSU6iT8xCLCnwNzdH9CP0FXj2h7B8EtHrYEINlOVUW8jpC1uHbYkAIBHyooUWm99SHJZD8R6qHV8BYw9hh6aCzAi3PxoN8kNjsfS6OTUpCJDHAolkvbbN0yDXiYWkKLR/KeMOSiw/uH5R6A0r1NU/Z9jp8m7cBmOpQXhPxcSkEBTIdlFQTGaUs/Ky3Hd0pAoS+Mf98Xwjg4Bg9iOv5f+c+WnLpEpsArJfkIDxkxVBp78Y/2uRnILIbQLbERr7aUsJCD9Ongw7c4cx3PSaNDcqfrgPEVq8n0TUIFD8pSQVmMAo4P6+LWZBBtFDJCLU1Sds2C2R4dyFSvZBlTSexKmfOsta+FzOKPn1cIfLJ3Zud4Z5R+icfTyUJmDh3O5kkJM7aMAi5Gw=",
"face_probability": 0.9996234179
}
]
}
}