Amazon facial recognition using Rekognition
I had a task from a customer to create a facial recognition database. I looked at allot of api’s but ended up landing on AWS Rekognition. I am going to document and provide some code to get started .
Step 1 . You need to create a collection of face images in S3
This is all done using the aws cli
aws rekognition create-collection \
--collection-id "faces" \
--region us-east-1 \
--profile user2
Step 2 . Once step 1 is done you can get the collection name
aws rekognition list-collections \
--region us-east-1 \
--profile user2
Step 3. Add images to the rekognition AI by sending images to it
aws rekognition index-faces \
--image '{"S3Object":{"Bucket":"<Yours3bucket>","Name":"scott.jpg"}}' \
--collection-id "faces" \
--region us-east-1 \
--profile user2
Step 4. Test by doing something like this
aws rekognition search-faces-by-image \
--image '{"S3Object":{"Bucket":"bucket-name","Name":"Example.jpg"}}' \
--collection-id "collection-id" \
--region us-east-1 \
--profile adminuser
or run python3 detect-many.py
Your Response should be something like this
Matched With 96.99021911621094% Similarity
To FaceId : 32276a6d-f838-558a-bc1b-6f6d6e8b79cf
Which is ImageId : 51b4f021-b8ab-5945-95ed-1c6c02db5b54
With 99.99979400634766 Confidence
This tool will allow you to load an s3 bucket of faces then compare one face to find out which face is a match .
Enjoy