Our Face Similarity API analyzes the similarity between two faces using a combination of our visual similarity model and our face detection model. This API accepts two images as input: a reference and target image. If there are multiple faces in either image, only the largest face will be analyzed. If there are no faces detected in either image, then the API call will fail.

In the JSON response for this API, similarity_score represents how similar the face in the reference image is to the face in the target image while score represents the model's confidence in the detection of the face in the target image. An example of the full response is shown below:

{
   "status":[
      {
         "status":{
            "code":"0",
            "message":"SUCCESS"
         },
         "_version":2,
         "response":{
            "input":{
               "model":"Face Comparison",
               "model_version":1,
               "model_type":"BOUNDING_BOX",
               "hash":"example_hash",
               "media":{
                  "url":null,
                  "filename":null,
                  "type":"PHOTO",
                  "mimetype":"jpg",
                  "duration":0,
                  "width":640,
                  "height":800
               }
            },
            "reference_image":{
               "file_path":"example_file_path",
               "file_type":"jpg",
               "file_size":30000,
               "media_type":"IMAGE",
               "duration":0,
               "fps":0,
               "height":640,
               "width":640,
               "timestamp":0
            },
            "frames":[
               {
                  "time":0,
                  "faces":[
                     {
                        "vertices":[
                           {
                              "x":148.91824340820312,
                              "y":34.87455749511719
                           },
                           {
                              "x":311.8807067871094,
                              "y":34.87455749511719
                           },
                           {
                              "x":311.8807067871094,
                              "y":326.03375244140625
                           },
                           {
                              "x":148.91824340820312,
                              "y":326.03375244140625
                           }
                        ],
                        "dimensions":{
                           "top":34.87455749511719,
                           "bottom":326.03375244140625,
                           "left":148.91824340820312,
                           "right":311.8807067871094
                        },
                        "meta":{
                           "type":"face",
                           "similarity_score":0.47769957615947367,
                           "score":0.9999967813491821,
                           "id":"sample_id"
                        }
                     }
                  ]
               }
            ]
         }
      }
   ]
}