Appendix D: Labeling State Machine - Media2Cloud

Appendix D: Labeling State Machine

Use the labeling state machine to index existing face images in your collection to improve the confidence level for face matching detection. To begin a labeling job, do the following:

  1. Play a video or an image.

  2. Choose the Snapshot button.

  3. Crop the face to be labeled.

  4. Choose Send to Ground Truth.

Your private work team receives a notification from Amazon SageMaker when the labeling job is ready. The worker signs in to the labeling portal using Amazon Cognito and performs the labeling job.


The Amazon Cognito user pool for the labeling state machine is separate from the Media2Cloud Amazon Cognito user pool. Your work team members are only given access to the labeling portal to perform the labeling jobs. They do not have access to any of your AWS resources.

The labeling state machine manages the face tagging workflow where it first creates a dataset and labeling job, waits for the workers to perform the job, collects the annotations, and indexes the results in the Amazon Rekognition face collection.

      Labeling workflow

Figure 18: Labeling workflow

  • Create dataset - Retrieves queued faces from the Amazon DynamoDB queued-faces table. If there is data, it creates a dataset manifest. If there is no data, the AWS Lambda function switches to the next state.

  • Create labeling job - Creates a labeling job by calling the Amazon SageMaker CreateLabelingJob API, updates the DynamoDB queued-face table, and transitions the labeling state to Wait.

  • Check labeling job status - Checks the labeling job status by calling the Amazon SageMaker DescribeLabelingJob API.

  • Index results state - Downloads and parses annotations, indexes faces in your face collection by calling the Amazon Rekognition IndexFaces API, and moves queued faces from the DynamoDB queued-face table to the indexed-face table.