Amazon Rekognition provides Deep learning-based image and video analysis. It provides key features:
- Object, scene and activity detection

- Facial recognition

- Facial analysis

- Person tracking

- Unsafe content detection
- Celebrity recognition

- Text in images

You will use Rekognition for face verification by saving and comparing faces stored in the collection.
- In AWS Console go to Rekognition at https://console.aws.amazon.com/rekognition/home?region=us-east-1#/.
- In the left navigation click on Object and scene detection and notice how Rekognition return labels for objects and activities detected in the image.
- In the left navigation click on Face comparison to see how Rekognition let you compare two faces and gives a confidence score on how closely they match.
- You can explore other feature including Image moderation, Facial analysis, Celebrity recognition and Text in image.
Amazon Rekognition can store information about detected faces in server-side containers known as collections. You can use the facial information stored in a collection to search for known faces in images, stored videos and streaming videos. You will use AWS CLI to create and manage Rekognition collections.
- Install the AWS CLI by following the instructions at the following link: https://docs.aws.amazon.com/cli/latest/userguide/installing.html
- Configure the AWS CLI by following the instructions at the following link: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
Rekognition will be consulted in order to check whether a face in the image sent by DeepLens is recognized (i.e. whether it exists in our Rekognition collection).
- On your laptop, either open a terminal window (Mac) or cmd (Windows) in order to use the AWS CLI.
- Type the following AWS CLI command to create a Rekognition collection:
aws rekognition create-collection --collection-id "dl-faces" --region us-east-1
- Verify that your Rekognition collection has been created:
aws rekognition list-collections --region us-east-1
- With the following command, you will see that there are currently no faces in your newly-created collection:
aws rekognition list-faces --collection-id "dl-faces" --region us-east-1
-
Upload images jb.jpg, andy1.jpg and andy2.png to your S3 bucket [Your name or username]-dl-faces.
-
Add both jb.jpg and andy1.jpg to Rekognition collection
aws rekognition index-faces --image "{\"S3Object\":{\"Bucket\":\"[Your name or username]-dl-faces\",\"Name\":\"jb.jpg\"}}" --external-image-id "JB" --collection-id "dl-faces" --detection-attributes "ALL" --region us-east-1
aws rekognition index-faces --image "{\"S3Object\":{\"Bucket\":\"[Your name or username]-dl-faces\",\"Name\":\"andy1.jpg\"}}" --external-image-id "Andy" --collection-id "dl-faces" --detection-attributes "ALL" --region us-east-1
- Now list the faces in your collection again and you should see JSON response with two faces in your Rekognition collection.
aws rekognition list-faces --collection-id "dl-faces" --region us-east-1
- We will now use andy2.png as source image to search faces stored in the Rekognition collection. You should see JSON response similar to below with it finding Andy's face with 99.9% confidence level.
aws rekognition search-faces-by-image --image "{\"S3Object\":{\"Bucket\":\"[Your name or username]-dl-faces\",\"Name\":\"andy2.png\"}}" --collection-id "dl-faces" --region us-east-1
- To delete a face from your collection, use the face-id that you get from list-faces command.
aws rekognition delete-faces --collection-id "dl-faces" --face-ids "FACE-ID-To-DELETE, GET FaceID FROM list-faces"
You have successfully created a Rekognition collection, stored faces in the collection and searched for faces by providing image from S3 bucket. You will use this collection in next modules to verify incoming faces from Deeplens. In the next Approval Workflow, you will learn how to build an approval workflow before sending incoming image from Deeplens to Rekognition collection.

