Face - Identify
在一个人组中识别未知的面部
对于faceids数组中每一张人脸,人脸识别会计算这张查询的脸和在人组中(personGroupId提供的)所有的脸之间的相似度,然后按照相似度等级排序返回一个候选的person(s)。人组应该是可以被鉴别的。更多知识请查看Person Group - Train Person Group.
Remarks:
* 该算法允许在相同的请求下独立识别多个面部,但不超过10个面部。
* Person group中的每个person可以有不止一张脸,但不超过248张脸
* 识别适用于正面和近正面
* 返回的候选人数量受maxNumOfCandidatesReturned和confidenceThreshold限制。如果没有人被识别,返回一个空数组
* 当需要从face list而不是person group中识别相似的脸部时,请尝试 Face - Find Similar
Http Method
`POST`
Request URL
`https://api.cognitive.azure.cn/face/v1.0/identify`
Request headers
| 请求头部 | 类型 | 描述 |
| --- | --- | --- |
| Content-Type(可选) | string | Media type of the body sent to the API. |
| Ocp-Apim-Subscription-Key | string | Subscription key which provides access to this API. Found in your Cognitive Services accounts. |
Request body
JSON fields in request body
| Fields | Type | Description |
| --- | --- | --- |
| faceIds | Array | 查询面faceIds组成的数组,由Face - Detect创建。每个面都是独立标识的。faceIds的有效数量在[1,10]之间|
| personGroupId | String | 指定的persong group 的personGroupId 由 Person Group - Create a Person Group.创建 |
| maxNumOfCandidatesReturned (可选) |Number | maxNumOfCandidatesReturned的范围在1到5之间(默认为1) |
| confidenceThreshold (可选) | Number | 可选参数。识别的置信度阈值,用于判断这张脸是否属于这个人。confidenceThreshold的范围是[0,1](默认由算法指定) |
~~~
{
"personGroupId":"sample_group",
"faceIds":[
"c5c24a82-6845-4031-9d5d-978df9175426",
"65d083d4-9447-47d1-af30-b626144bf0fb"
],
"maxNumOfCandidatesReturned":1,
"confidenceThreshold": 0.5
}
~~~
Response 200
成功后,返回每个查询返回标识的候选人员
JSON fields in response body
| Fields | Type | Description |
| --- | --- | --- |
| faceId | String | 查询面的faceId |
| Candidates | Array | 符合请求的面部数据识别的person,根据相似度排序 |
| personId | String | 获选人的personId |
|confidence | Number | 一个0.0-1.0之间的浮点数 |
~~~
{
[
{
"faceId":"c5c24a82-6845-4031-9d5d-978df9175426",
"candidates":[
{
"personId":"25985303-c537-4467-b41d-bdb45cd95ca1",
"confidence":0.92
}
]
},
{
"faceId":"65d083d4-9447-47d1-af30-b626144bf0fb",
"candidates":[
{
"personId":"2ae4935b-9659-44c3-977f-61fac20d0538",
"confidence":0.89
}
]
}
]
}
~~~
Response 400
Error code and message returned in JSON
| Error Code | Error Message Description |
| --- | --- |
| BadArgument | 无效的请求正文 |
| BadArgument | 参数maxNumOfCandidatesReturned无效。范围是[1,5] |
| BadArgument | 参数confidenceThreshold无效。范围是[0,1] |
| BadArgument |FaceID无效 |
| BadArgument | Person group ID无效。有效格式应该是由数字组成的字符串,英文字母小写,' - ','_',不超过64个字符。 |
| PersonGroupNotFound | Person group未找到 |
| FaceNotFound | Face未找到|
| PersonGroupNotTrained | Person group 样本点未trained|
~~~
{
"error":{
"code":"BadArgument",
"message":"Person group 'sample_group' is invalid."
}
}
~~~
返回值401
Error code and message returned in JSON
| Error Code| Error Message Description |
| --- | --- |
| Unspecified | 无效的subscription Key或用户/计划被冻结 |
~~~
{
"error":{
"code": "Unspecified",
"message": "Access denied due to invalid subscription key. Make sure you are subscribed to an API you are trying to call and provide the right key."
}
}
~~~
Response 403
~~~
{
"error":{
"statusCode": 403,
"message": "Out of call volume quota. Quota will be replenished in 2.12 days."
}
}
~~~
Response 409
训练过程与识别相冲突。训练结束后再试一次
~~~
{
"error":{
"code":"PersonGroupTrainingNotFinished",
"message":"Person group 'sample_group' is under training."
}
}
~~~
Response 415
不支持的媒体类型错误。只有“application / json”对这个API有效
~~~
{
"error":{
"code":"BadArgument",
"message":"Invalid Media Type"
}
}
~~~
Response 429
~~~
{
"error":{
"statusCode": 429,
"message": "Rate limit is exceeded. Try again in 26 seconds."
}
}
~~~
- 空白目录
- Face
- Detect
- Find Similar
- Group
- Identify
- Verify
- Face List
- Add a Face to a Face List
- Create a Face List
- Delete a Face from a Face List
- Delete a Face List
- Get a Face List
- List Face Lists
- Update a Face List
- Person
- Add a Person Face
- Create a Person
- Delete a Person
- Delete a Person Face
- Get a Person
- Get a Person Face
- List Persons in a Person Group
- Update a Person
- Update a Person Face
- Person Group
- Create a Person Group
- Delete a Person Group
- Get a Person Group
- Get Person Group Training Status
- List Person Groups
- Train Person Group
- Update a Person Group