Rekognition IndexFaces and FaceIDs

How Amazon Rekognition IndexFaces assigns FaceIDs, and how ExternalImageID affects deduplication across multiple runs.

Understanding how Rekognition assigns FaceIDs is important for building reliable face deduplication in the Nomad Media processing pipeline.

Without ExternalImageID

When an image containing multiple faces is submitted to IndexFaces without an ExternalImageID, each face in the image gets a unique FaceID. The ImageId is the same for all faces in a given submission, but subsequent runs of the same image on the same collection will produce different FaceIDs for the same faces.

Input:

{
    CollectionId: aws.String("demo3-rekognition-collection"),
    Image: &rekognition.Image{
        Bytes: []byte(<image bytes>),
    },
}

First run — two FaceIDs assigned, same ImageId:

{
  "FaceRecords": [
    { "Face": { "FaceId": "c0e35b9f-...", "ImageId": "d9f50257-..." } },
    { "Face": { "FaceId": "570f9355-...", "ImageId": "d9f50257-..." } }
  ]
}

Second run — different FaceIDs assigned to the same faces:

{
  "FaceRecords": [
    { "Face": { "FaceId": "c0bc180b-...", "ImageId": "d9f50257-..." } },
    { "Face": { "FaceId": "c0e35b9f-...", "ImageId": "d9f50257-..." } }
  ]
}

With ExternalImageID

When an ExternalImageId is supplied, Rekognition uses it to deduplicate. If the same face appears more than once in the same image and an ExternalImageId is provided, that face gets a consistent FaceID across runs.

Input:

{
    CollectionId: aws.String("demo3-rekognition-collection"),
    Image: &rekognition.Image{
        Bytes: []byte(<image bytes>),
    },
    ExternalImageId: aws.String("blah"),
}

Both the first and second runs return the same FaceIDs for the same faces.

Single Face on a New Collection

Submitting a single-face image without ExternalImageID to a new collection produces the same FaceID on every run.

On an existing collection, the system matches to an already-indexed FaceID. If the face was previously indexed with two FaceIDs, the new submission will return one of those existing IDs.

ExternalImageID Behavior Summary

ScenarioFaceID behavior
No ExternalImageID, new collectionSame FaceID every run for a single face
No ExternalImageID, existing collectionReturns a previously indexed FaceID
ExternalImageID, new submissionNew FaceID generated
ExternalImageID, existing ExternalImageID in collectionReturns the existing FaceID
Duplicate face in image + ExternalImageIDSame FaceID returned for both instances