API reference

Compare faces

Score how alike the faces in two images are.

POST /v1/face-similarity/match1 operation per pair

The programmatic form of Compare faces in the dashboard — same models, same allowance.

Request

multipart/form-data, with your key as a bearer token.

FieldTypeDefaultDescription
image1requiredfileFirst image.
image2requiredfileSecond image.
modelstringarcfaceEmbedding model.
thresholdnumber0.75Match threshold 0–1, reported back so you can compare against it.

Example

curl -X POST https://api.quantilence.com/v1/face-similarity/match \
  -H "Authorization: Bearer $QUANTILENCE_API_KEY" \
  -F "image1=@first.jpg" \
  -F "image2=@second.jpg" \
  -F "model=arcface" \
  -F "threshold=0.75"

Response

200 OK with this shape. Values below are illustrative; the keys and types are not.

{
  "success": true,
  "similarity": [
    {
      "face_1_name": "face_1",
      "face_1_data": "/9j/4AAQSkZJRg…",
      "face_2_name": "face_1",
      "face_2_data": "/9j/4AAQSkZJRg…",
      "sim_score": 87.4
    }
  ],
  "image1_face_count": 1,
  "image2_face_count": 1,
  "image1": {
    "width": 1024,
    "height": 768,
    "faces": [
      {
        "name": "face_1",
        "bbox": [
          412,
          188,
          523,
          361
        ],
        "confidence": 0.93
      }
    ]
  },
  "image2": {
    "width": 800,
    "height": 600,
    "faces": [
      {
        "name": "face_1",
        "bbox": [
          301,
          142,
          409,
          298
        ],
        "confidence": 0.9
      }
    ]
  },
  "model": "arcface",
  "threshold": 0.75,
  "processing_time_ms": 331.2
}
FieldTypeDescription
successbooleanAlways true on a 200.
similarityPair[]Every face in image 1 against every face in image 2.
similarity[].face_1_namestringLabel within image 1.
similarity[].face_1_datastringBase64 crop of that face.
similarity[].face_2_namestringLabel within image 2.
similarity[].face_2_datastringBase64 crop.
similarity[].sim_scorefloat0–100, NOT 0–1. Fifty is the recognition threshold.
image1_face_countintegerFaces found in image 1.
image2_face_countintegerFaces found in image 2.
image1ImageFaces | nullFrame size and per-face boxes, so a pair can be located on the original.
image2ImageFaces | nullThe same for image 2.
modelstringModel used.
thresholdfloatThreshold applied, 0–1.
processing_time_msfloatModel time.

Worth knowing

  • `sim_score` is a percentage 0–100 while `threshold` is 0–1. Compare `sim_score / 100` against it.
  • Both images may contain several faces; you get every combination, so check the counts before assuming one pair.