/face/predict_gender
1.API Specification
2.Request Params
3.Response Params
4.Error Codes
5.Sample
1.API Specification
This API is used to predict gender of a face in the uploaded image.
Image Spec
1. Format: JPG(JPEG), PNG
2. Between 128*128 and 6000*6000 (pixels)
3. File size: no larger than 5 MB
Request Method
POST
Request URL
https://cloudapi.accuauth.in/face/predict_gender
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
Fields | Type | Required | Description |
---|---|---|---|
file | file | See the note below | Image file,binary data of the image |
image_base64 | string | See the note below | Base64 encoded data of image |
Either parameter
file
orimage_base64
must be provided as a request parameter.You MUST add image stream to multipart/form-data section of POST message when using
file
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 |
result | object | Predict result, see result for detail |
3.1 Elements in result
Parameter | Type | Description |
---|---|---|
gender | string | The gender, Male or Female |
confidence | float | Gender confidence, 0.5 is the default threshold |
face_box | array | Face bbox region |
beard | bool | Whether the face has a beard |
beard_confidence | float | Beard confidence, 0.5 is the default threshold |
Response Syntax
{
"result": {
"beard": false,
"beard_confidence": 0.004682,
"confidence": 0.996771,
"face_box": [
81,
88,
244,
299
],
"gender": "Male"
},
"status": "OK",
"request_id": "TIDe4a66115d93f4f45982ceb62d0a1eccf"
}
4.Error Codes
Error code | Status value | Description |
---|---|---|
400 |
INVALID_ARGUMENT | The request parameter error |
400 |
DETECTION_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 |
Reponse Syntax:
{
"status": "INVALID_ARGUMENT",
"reason": "must specify 'file' or 'image_base64' argument",
"request_id": "TID8bf47ab6eda64476973cc5f5b6ebf57e"
}