Domain name for API request: iai.tencentcloudapi.com.
This API is used to detect the position, attributes, and quality information of a face in the given image. The position information includes (x, y, w, h); the face attributes include gender, age, expression, beauty, glass, hair, mask, and pose (pitch, roll, yaw); and the face quality information includes the overall quality score, sharpness, brightness, and completeness.
The face quality information is mainly used to evaluate the quality of the input face image. When using the Face Recognition service, we recommend evaluating the quality of the input face image first to improve the effects of subsequent processing. Application scenarios of this feature include:
Creating/Adding a person in a group: this is to ensure the quality of the face information to facilitate subsequent processing.
Face search: this is to ensure the quality of the input image to quickly find the corresponding person.
Face verification: this is to ensure the quality of the face information to avoid cases where the verification incorrectly fails.
Face fusion: this is to ensure the quality of the uploaded face images to improve the fusion effect.
SignatureMethod
parameter to TC3-HMAC-SHA256
.The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
Parameter Name | Required | Type | Description |
---|---|---|---|
Action | Yes | String | Common Params. The value used for this API: DetectFace. |
Version | Yes | String | Common Params. The value used for this API: 2020-03-03. |
Region | No | String | Common Params. This parameter is not required for this API. |
MaxFaceNum | No | Integer | Maximum number of processable faces. Default value: 1 (i.e., detecting only the face with the largest size in the image). Maximum value: 120. This parameter is used to control the number of faces in the image to be detected. The smaller the value, the faster the processing. |
MinFaceSize | No | Integer | Minimum height and width of face in px. Default value: 34. We recommend keeping it at or above 34. Faces below the MinFaceSize value will not be detected. |
Image | No | String | Base64-encoded image data, which cannot exceed 5 MB. The long side cannot exceed 4,000 px for images in JPG format or 2,000 px for images in other formats. PNG, JPG, JPEG, and BMP images are supported, while GIF images are not. |
Url | No | String | Image URL. The image cannot exceed 5 MB in size after being Base64-encoded. The long side cannot exceed 4,000 px for images in JPG format or 2,000 px for images in other formats. Either Url or Image must be provided; if both are provided, only Url will be used. We recommend storing the image in Tencent Cloud, as a Tencent Cloud URL can guarantee higher download speed and stability. The download speed and stability of non-Tencent Cloud URLs may be low. PNG, JPG, JPEG, and BMP images are supported, while GIF images are not. |
NeedFaceAttributes | No | Integer | Whether the face attribute information (FaceAttributesInfo) needs to be returned. 0: no; 1: yes. Default value: 0. If the value is not 1, it will be deemed as no need to return, and FaceAttributesInfo is meaningless in this case. The face attribute information of up to 5 largest faces in the image will be returned, and FaceAttributesInfo of the 6th and rest faces is meaningless. Extracting face attribute information is quite time-consuming. If face attribute information is not required, we recommend disabling this feature to speed up face detection. |
NeedQualityDetection | No | Integer | Whether to enable quality detection. 0: no; 1: yes. Default value: 0. If the value is not 1, it will be deemed not to perform quality detection. The face quality score information of up to 30 largest faces in the image will be returned, and FaceQualityInfo of the 31st and rest faces is meaningless. We recommend enabling this feature for the face adding operation. |
FaceModelVersion | No | String | Algorithm model version used by the Face Recognition service. Currently, 2.0 and 3.0 are supported.This parameter is 3.0 by default starting from April 2, 2020. If it is left empty for accounts that used this API, 2.0 will be used by default.The parameter can be set only to 3.0 for accounts that purchase the service after November 26, 2020.Different algorithm model versions correspond to different face recognition algorithms. The 3.0 version has a better overall effect than the legacy version and is recommended. |
NeedRotateDetection | No | Integer | Whether to enable the support for rotated image recognition. 0: no; 1: yes. Default value: 0. When the face in the image is rotated and the image has no EXIF information, if this parameter is not enabled, the face in the image cannot be correctly detected and recognized. If you are sure that the input image contains EXIF information or the face in the image will not be rotated, do not enable this parameter, as the overall time consumption may increase by hundreds of milliseconds after it is enabled. |
Parameter Name | Type | Description |
---|---|---|
ImageWidth | Integer | Width of requested image. |
ImageHeight | Integer | Height of requested image. |
FaceInfos | Array of FaceInfo | Face information list, including face coordinate information, attribute information (if needed), and quality score information (if needed). |
FaceModelVersion | String | Algorithm model version used for face recognition. |
RequestId | String | The unique request ID, which is returned for each request. RequestId is required for locating a problem. |
https://iai.tencentcloudapi.com/?Action=DetectFace
&MaxFaceNum=1
&MinFaceSize=40
&Url=http://test.image.myqcloud.com/testB.jpg
&NeedFaceAttributes=0
&NeedQualityDetection=0
&<Common request parameters>
{
"Response": {
"ImageWidth": 640,
"ImageHeight": 440,
"FaceInfos": [
{
"X": 156,
"Y": 129,
"Width": 196,
"Height": 196,
"FaceAttributesInfo": {
"Gender": 0,
"Age": 0,
"Expression": 0,
"Hat": false,
"Glass": false,
"EyeOpen": true,
"Mask": false,
"Hair": {
"Length": 0,
"Bang": 0,
"Color": 0
},
"Pitch": 0,
"Yaw": 0,
"Roll": 0,
"Beauty": 0
},
"FaceQualityInfo": {
"Score": 0,
"Sharpness": 0,
"Brightness": 0,
"Completeness": {
"Eyebrow": 0,
"Eye": 0,
"Nose": 0,
"Cheek": 0,
"Mouth": 0,
"Chin": 0
}
}
}
],
"FaceModelVersion": "3.0",
"RequestId": "a574102d-1b86-48a7-a08b-6a741a8fedb6"
}
}
https://iai.tencentcloudapi.com/?Action=DetectFace
&MaxFaceNum=1
&MinFaceSize=40
&Url=http://test.image.myqcloud.com/testA.jpg
&NeedFaceAttributes=1
&NeedQualityDetection=1
&<Common request parameters>
{
"Response": {
"ImageWidth": 640,
"ImageHeight": 440,
"FaceInfos": [
{
"X": 156,
"Y": 129,
"Width": 196,
"Height": 196,
"FaceAttributesInfo": {
"Gender": 99,
"Age": 51,
"Expression": 99,
"Hat": false,
"Glass": false,
"EyeOpen": true,
"Mask": true,
"Hair": {
"Length": 1,
"Bang": 1,
"Color": 0
},
"Pitch": 17,
"Yaw": 5,
"Roll": -2,
"Beauty": 71
},
"FaceQualityInfo": {
"Score": 63,
"Sharpness": 73,
"Brightness": 47,
"Completeness": {
"Eyebrow": 99,
"Eye": 99,
"Nose": 99,
"Cheek": 52,
"Mouth": 99,
"Chin": 47
}
}
}
],
"FaceModelVersion": "3.0",
"RequestId": "bcde47b5-e6d8-446e-a538-bcecffbe306a"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
Error Code | Description |
---|---|
AuthFailure.InvalidAuthorization | Authentication failed. |
FailedOperation | Operation failed. |
FailedOperation.ConflictOperation | The operations conflict. Do not operate on the same person simultaneously. |
FailedOperation.DuplicatedGroupDescription | The custom description field must be unique in the group. |
FailedOperation.FaceSizeTooSmall | The face frame size is smaller than the MinFaceSize value, and the face is filtered out. |
FailedOperation.GroupInDeletedState | The current group is being deleted. Please wait. |
FailedOperation.GroupPersonMapExist | The ID of the corresponding person is already in the group. |
FailedOperation.GroupPersonMapNotExist | The ID of the corresponding person is not in the group. |
FailedOperation.ImageDecodeFailed | Image decoding failed. |
FailedOperation.ImageDownloadError | An error occurred while downloading the image. |
FailedOperation.ImageFacedetectFailed | Face detection failed. |
FailedOperation.ImageResolutionExceed | The image resolution is too high. |
FailedOperation.ImageResolutionTooSmall | The image short edge resolution is smaller than 64. |
FailedOperation.ImageSizeExceed | The size of the Base64-encoded image cannot exceed 5 MB. |
FailedOperation.RequestLimitExceeded | The request frequency exceeds the limit. |
FailedOperation.RequestTimeout | The backend service timed out. |
FailedOperation.SearchFacesExceed | The number of faces searched for exceeds the limit. |
FailedOperation.ServerError | The algorithm service is exceptional. Please retry. |
FailedOperation.UnKnowError | An internal error occurred. |
InternalError | Internal error. |
InvalidParameter.InvalidParameter | Invalid parameter. |
InvalidParameterValue.AccountFaceNumExceed | The number of faces in the account exceeds the limit. |
InvalidParameterValue.DeleteFaceNumExceed | The number of faces to be deleted exceeds the limit. Every person must have at least one face image. |
InvalidParameterValue.FaceModelVersionIllegal | The algorithm model version is invalid. |
InvalidParameterValue.GroupExDescriptionsExceed | The array length of the group's custom description fields exceeds the limit. Up to 5 fields can be created. |
InvalidParameterValue.GroupExDescriptionsNameIdentical | The name of the group's custom description field must be unique. |
InvalidParameterValue.GroupExDescriptionsNameIllegal | The name of the group's custom description field contains invalid characters. It can contain only letters, - , _ , and digits. |
InvalidParameterValue.GroupExDescriptionsNameTooLong | The name of the group's custom description field exceeds the length limit. |
InvalidParameterValue.GroupFaceNumExceed | The number of faces in the group exceeds the limit. |
InvalidParameterValue.GroupIdAlreadyExist | The group ID already exists. It must be unique. |
InvalidParameterValue.GroupIdIllegal | The group ID contains invalid characters. It can contain only letters, digits, and special symbols (-%@#&_). |
InvalidParameterValue.GroupIdNotExist | The group ID does not exist. |
InvalidParameterValue.GroupIdTooLong | The group ID exceeds the length limit. |
InvalidParameterValue.GroupIdsExceed | The list of groups passed in exceeds the limit. |
InvalidParameterValue.GroupNameAlreadyExist | The group name already exists. It must be unique. |
InvalidParameterValue.GroupNameIllegal | The group name contains invalid characters. It can contain only letters, - , _ , and digits. |
InvalidParameterValue.GroupNameTooLong | The group name exceeds the length limit. |
InvalidParameterValue.GroupNumExceed | The number of groups exceeds the limit. If you need more, please contact us. |
InvalidParameterValue.GroupNumPerPersonExceed | The number of groups exceeds the limit. One person can be added to up to 100 groups. |
InvalidParameterValue.GroupTagIllegal | The group remarks field contains invalid characters. It can contain only letters, - , _ , and digits. |
InvalidParameterValue.GroupTagTooLong | The group remarks field exceeds the length limit. |
InvalidParameterValue.ImageEmpty | Empty image. |
InvalidParameterValue.LimitExceed | The number of returned results exceeds the limit. |
InvalidParameterValue.NoFaceInGroups | There are no faces in the specified group. |
InvalidParameterValue.NoFaceInPhoto | There are no faces in the image. |
InvalidParameterValue.OffsetExceed | The starting number is too large. Please check the length of the array to be requested. |
InvalidParameterValue.PersonExDescriptionInfosExceed | The array length of the person's custom description fields exceeds the limit. Up to 5 fields are allowed. |
InvalidParameterValue.PersonExDescriptionsNameIdentical | The name of the person's custom description field must be unique. |
InvalidParameterValue.PersonExDescriptionsNameIllegal | The name of the person's custom description field contains invalid characters. It can contain only letters, - , _ , and digits. |
InvalidParameterValue.PersonExDescriptionsNameTooLong | The name of the person's custom description field exceeds the length limit. |
InvalidParameterValue.PersonExistInGroup | The ID of the corresponding person is already in the group. |
InvalidParameterValue.PersonFaceNumExceed | The number of face images for the person exceeds the limit. One person can have up to 5 face images. |
InvalidParameterValue.PersonGenderIllegal | An error occurred while setting person gender. 0: empty; 1: male; 2: female. |
InvalidParameterValue.PersonIdAlreadyExist | The person ID already exists. It must be unique. |
InvalidParameterValue.PersonIdIllegal | The person ID contains invalid characters. It can contain only letters, digits, and -%@#&_. |
InvalidParameterValue.PersonIdNotExist | The person ID does not exist. |
InvalidParameterValue.PersonIdTooLong | The person ID field exceeds the length limit. |
InvalidParameterValue.PersonNameIllegal | The person name contains invalid characters. It can contain only letters, - , _ , and digits. |
InvalidParameterValue.PersonNameTooLong | The person name exceeds the length limit. |
InvalidParameterValue.SearchPersonsExceed | The number of persons searched for exceeds the limit. |
InvalidParameterValue.UploadFaceNumExceed | Up to four faces can be uploaded at a time. |
InvalidParameterValue.UrlIllegal | Invalid URL format. |
LimitExceeded.ErrorFaceNumExceed | The number of faces exceeds the limit. |
MissingParameter.ErrorParameterEmpty | A required parameter is empty. |
ResourceUnavailable.Delivering | The resource is being shipped. |
ResourceUnavailable.Freeze | The account is frozen. |
ResourceUnavailable.InArrears | The account is in arrears. |
ResourceUnavailable.LowBalance | Insufficient balance. |
ResourceUnavailable.NotExist | The billing status is unknown. Please check whether the service has been activated in the console. |
ResourceUnavailable.Recover | The resource has been repossessed. |
ResourceUnavailable.StopUsing | The service has been suspended for the account. |
ResourceUnavailable.UnknownStatus | The billing status is unknown. |
ResourcesSoldOut.ChargeStatusException | The billing status is exceptional. |
UnsupportedOperation.UnknowMethod | Unknown method name. |
Was this page helpful?