Face Compare

Compare between the two images if the person in the image is the same person.

Image Requirements

Type : JPG (JPEG), PNG Format : Base64 Size : Must be over 112*112 pixels Minimum size of face : The bounding size of a detected face should be over than 112 pixels.

Request Parameter

NameTypeDescription

Required

image1

String

Base64 encoded binary data of first image.

Required

image2

String

Base64 encoded binary data of second image.

Optional

verified_document

Boolean

Whether or not verify that in images have ID card. Note: default value is False.

Optional

image1_is_document

Boolean

To verify whether an image in image1 parameter has ID Card. Note: default value is False.

Optional

image2_is_document

Boolean

To verify whether an image in image2 parameter has ID Card. Note: default value is False.

Optional

blur_detection

Boolean

Whether or not detect blurriness from images. Note: default value is False.

Return Values

FieldsTypeDescription

request_id

String

Unique id each request

confidence

Float

Indicates the similarity of two faces, a floating-point number with 2 decimal places between [0,100]. Higher confidence indicates higher possibility that two faces belong to same person. Note: if no face is detected within image uploaded, this string will not be returned.

thresholds

Object

A set of thresholds including 3 floating-point numbers with 2 decimal places between [0,100]. If the confidence does not meet the "err_01" threshold, it is highly suggested that the two faces are not from the same person. While if the confidence is beyond the "err_0001" threshold, there's high possibility that they are from the same person. err_01: confidence threshold at the 0.1% error rate; err_001: confidence threshold at the 0.01% error rate; err_0001: confidence threshold at the 0.001% error rate; Note: seeing that thresholds are not static, there's no need to store values of thresholds in a persistent form, especially not to compare the confidence with a previously returned threshold. If no face is detected within image uploaded, this string will not be returned.

time_used

Float

Duration. Unit: second

error_message

String

This string will not be returned unless request fails. For more details, please see the following section on error message.

Error Message

HTTP StatusError MessageDescription

400

IMAGE_ERROR_UNSUPPORTED_FORMAT: <param>

The image which <param> indicates can not be resolved. The file format may not be supported or the file is damaged.

200

CAN_NOT_DETECT_FACE: <param>

The image which <param> does not have face.

200

IMAGE_BLURED: <param>

The image which <param> is blured.

200

CAN_NOT_DETECT_IDCARD: <param>

The image which <param> does not have ID card.

Compare between the two images if the person in the image is the same person.

POST https://apis.aigen.online/aiface/face-compare/v1

Request Body

NameTypeDescription

image1*

String

​Base64 encoded binary data of first image.

image2*

String

Base64 encoded binary data of second image.

verified_document

Boolean

Whether or not verify that in images have ID card. Note: default value is False.

image1_is_document

Boolean

To verify whether an image in image1 parameter has ID Card. Note: default value is False.

image2_is_document

Boolean

To verify whether an image in image2 parameter has ID Card. Note: default value is False.

blur_detection

Boolean

Whether or not detect blurriness from images. Note: default value is False.

{
  "request_id": "string",
  "confidence": 100,
  "thresholds": {
    "err_01": 45.92,
    "err_001": 54.36,
    "err_0001": 59.71
  },
  "time_used": 0,
  "error_message": "error_message"
}
import requests
import json

api = "https://apis.aigen.online/aiface/face-compare/v1"
headers = {"x-aigen-key": "<key>", "content-type": "application/json"}
data = json.dumps({
    "image1": "<base64_string>",
    "image2": "<base64_string>",
})

res = requests.post(api, data=data, headers=headers)
print(res.json())

Last updated