/face/liveness_anti_hack
1.API Specification
2.Request Params
3.Response Params
4.Error Codes
5.Sample
1.API Specification
This API is used to check if it has hack behavior in the uploaded liveness data.
Request Method
POST
Request URL
https://cloudapi.peru.accuauth.com/face/liveness_anti_hack
Debugging Tool
2.Request Params
2.1 Request Header
Parameter | Type | Required | Description |
---|---|---|---|
X-DF-API-ID | string | Yes | For API credentials,Please visit API Request |
X-DF-API-SECRET | string | Yes | For API credentials,Please visit API Request |
2.2 Request Body
Parameter | Type | Required | Description |
---|---|---|---|
liveness_data_file | file | No | Liveness protobuf file which is from Liveness SDK |
image_id | string | No | Image ID from H5 Liveness SDK |
return_image | int | No | Whether to return image; 0: No, 1: Yes, default is 0 |
return_extra | int | No | Whether to return extra information; 0: No, 1: Yes, default is 0 |
You MUST add image stream to multipart/form-data section of POST message when using liveness_data_url parameter.
3.Response Params
Parameter | Type | Description |
---|---|---|
request_id | string | Unique id of each request |
status | string | Response status, OK if request success, other if failed; See Error Codes for details |
score | float | Hack score[0.0-1.0], the greater of the value the greater probablitity of non-human |
image_base64 | string | Base64 encoded image |
extra | object | Extra information, see extra for detail |
NOTE: The recommended hackness score threshold value is 0.98, which is set based on training data. If hackness score is below 0.98, it would be a real person.
3.1 Elements in extra
Parameter | Type | Description | |
---|---|---|---|
mask_proba | float | Probability of the face is masked, 0.5 is the recommended threshold | |
quality_score | float | Quality score, 0.5 is the recommended threshold | |
quality_too_low | bool | Whether the image quality is too low | |
blur_or_dark | bool | Whether the image is blur or dark | |
has_no_face | bool | Whether the image has a face | |
face_too_small | bool | Whether the face is too small | |
image_too_small | bool | Whether the image is too small | |
masked | bool | Whether the face is masked | |
face_quality_low | bool | Whether the face quality is too low | |
face_quality_score | bool | Face quality score, 0.5 is the recommended threshold | |
is_live | bool | Whether the face is live | |
live_proba | bool | Liveness score, 0.5 is the recommended threshold | |
eye_closed | bool | Whether the eyes are closed | |
eye_score | float | Probability of the eyes being open, 0.5 is the default threshold | |
img_ort | int | The face orientation detected, 0: 0 degrees(top of head up), 1: 90 degrees counter clockwise(top of head to left), 2: 180 degrees counter clockwise(top of head down), 3: 270 degrees counter clockwise(top of head to right) | |
face_count | int | Number of faces detected |
Response Syntax
{
"request_id": "TID8bf47ab6eda64476973cc5f5b6ebf57e",
"status": "OK",
"score":"0.13119",
"extra": {
"mask_proba": 0.001,
"quality_score": 0.961,
"quality_too_low": false,
"blur_or_dark": false,
"has_no_face": false,
"face_too_small": false,
"image_too_small": false,
"masked": false,
"face_quality_low": false,
"face_quality_score": 0.9981434181918459,
"is_live": true,
"live_proba": 0.9967548623045266,
"eye_closed": false,
"eye_score": 0.9786062829240756
},
"image_base64": "xxxxxx"
}
4.Error Codes
Error code | Status value | Description |
---|---|---|
400 |
INVALID_ARGUMENT | The request parameter error |
400 |
DETETION_FAILED | Detect image failed |
400 |
DOWNLOAD_ERROR | Download internet image failed |
401 |
UNAUTHORIZED | Unauthorize or authorize failed |
401 |
KEY_EXPIRED | Your API ID has expired |
403 |
NO_PERMISSION | You are not authorized to use this API |
403 |
OUT_OF_QUOTA | API calls quota exceeded |
403 |
RATE_LIMIT_EXCEEDED | The invoke number is out of limitation |
404 |
NOT_FOUND | The request path is not found |
500 |
INTERNAL_ERROR | Server processes failed |
Response Syntax
{
"status": "INVALID_ARGUMENT",
"reason": "must specify liveness_data_file' argument",
"request_id": "TID8bf47ab6eda64476973cc5f5b6ebf57e"
}