Skip to main content
POST
/
api
/
portrait
/
analysis
/
face-key-points
Facial Landmarks
curl --request POST \
  --url https://www.ailabapi.com/api/portrait/analysis/face-key-points \
  --header 'Content-Type: multipart/form-data' \
  --header 'ailabapi-api-key: <api-key>' \
  --form 'max_face_num=<string>' \
  --form 'face_field=<string>' \
  --form image=@example-file
{
"request_id": "",
"log_id": "",
"error_code": 0,
"error_code_str": "",
"error_msg": "",
"error_detail": {
"status_code": 200,
"code": "",
"code_message": "",
"message": ""
},
"result": {
"face_num": "",
"face_list": [
{
"face_token": "",
"location": {
"left": 0,
"top": 0,
"width": 0,
"height": 0,
"rotation": 0
}
}
],
"face_probability": 0,
"angle": [
{
"yaw": 0,
"pitch": 0,
"roll": 0
}
],
"age": 0,
"gender": [
{
"type": "",
"probability": 0
}
],
"landmark4": [
{
"x": 148.37,
"y": 100.59
},
{
"x": 234.82,
"y": 90.52
},
{
"x": 199.34,
"y": 135.81
},
{
"x": 203.17,
"y": 179.29
}
]
}
}

Request

  • URL: https://www.ailabapi.com/api/portrait/analysis/face-key-points
  • Method: POST
  • Content-Type: multipart/form-data

Image requirements

  • Image format: JPEG JPG BMP PNG
  • Image size: No more than 8 MB.
  • Image resolution: Less than 1920x1080px.

Headers

FieldRequiredTypeDescription
ailabapi-api-keyYESstringApplication API KEY. Get API KEY

Body

FieldRequiredTypeScopeDefaultExampleDescription
imageYESfile
max_face_numNOinteger1, 2, 3, 4, 5, 6, 7, 8, 9, 101The maximum number of faces to process. The default value is 1 (only the face with the largest area in the image is detected).
face_fieldNOstringage, gender, landmark4, landmark72, landmark150, landmark201age,gender,landmark4age`: Age information.`, gender: Gender information., landmark4`: 4 feature points.`, landmark72: 72 feature points., landmark150`: 150 feature points.`, landmark201: 201 feature points.

Response

Response Field Handling Flow
  1. Handle Public Response Fields Parse and validate the Public Response Fields, checking the status code or response message to ensure the request is successful and error-free.
  2. Handle Business Response Fields If the Public Response Fields are valid and error-free, proceed with processing the business logic in the Business Response Fields.

Public Response Fields

Viewing Public Response Fields and Error Codes

Business Response Fields

FieldTypeScopeDescription
resultobjectThe content of the result data returned.
+face_numintegerThe number of faces in the picture.
+face_listarrayList of face information.
++face_tokenstringFace Token.
++locationobjectThe position of the face in the picture.
+++leftfloatThe distance of the face area from the left border.
+++topfloatThe distance of the face area from the upper boundary.
+++widthfloatThe width of the face area.
+++heightfloatThe height of the face area.
+++rotationinteger[-180, 180]The clockwise rotation angle of the face frame with respect to the vertical direction.
++face_probabilityfloat[0, 1]Face confidence.
++angleobjectFace rotation parameters, refer to Face Spatial Pose Angle Reference for detailed description.
+++yawfloat[-90, 90]The left and right rotation angle of 3D rotation.
+++pitchfloat[-90, 90]Three-dimensional rotation of the pitch angle.
+++rollfloat[-180, 180]In-plane rotation angle.
++agefloatAge.
++genderobjectGender information.
+++typestringmale, female
+++probabilityfloat[0, 1]Gender confidence.
++landmark4array4 feature points.
++landmark72array72 feature points. Refer to 72 feature points for details.
++landmark150object150 feature points. Refer to 150 feature points for details.
++landmark201object201 feature points. Refer to 201 feature points for details.

Response Example

Sample Code

Authorizations

ailabapi-api-key
string
header
required

API Key for authentication

Body

multipart/form-data
image
file
max_face_num
string

The maximum number of faces to process. The default value is 1 (only the face with the largest area in the image is detected).

face_field
string

Returns more information about the face (by default only face_token, face frame, probability and rotation angle are returned). <li>age: Age information.</li> <li>gender: Gender information.</li> <li>landmark4: 4 feature points.</li> <li>landmark72: 72 feature points.</li> <li>landmark150: 150 feature points.</li> <li>landmark201: 201 feature points.</li>

Response

200 - application/json

Success

The response is of type object.