Discover yourself

Posted in AWS Blog
16/11/2018 Michiel Vanderlinden

Do you know the burden? Do you feel the pain? Returning home from a great music festival or a fantastic party, a great time and nothing to remember it by. There must be some pictures. You search the website or Facebook page of the event and there it is, an album full of memories of that great time, 1697 of them! The date is November 12 2018 and nobody has time to search for embarrassing pictures of themselves. But there is hope, these days we are not only cursed with the burden of little time but blessed with the gift of technology as well, the gift of cloud computing for everyone, the gift of AWS Rekognition, our lord, our savior.

In this blog we will use AWS Rekognition to search for ourselves in a collection of pictures.

First we need to acquire this collection, I simply used a Chrome extension to download all pictures of a specific Facebook album.

Next, we will create an S3 bucket to store the pictures, because this project reminds me a bit of where’s waldo I will name the bucket ‘awesome-waldo-bucket’.

Now we will upload all the pictures to this bucket using the command.

aws s3 sync . s3://awesome-waldo-bucket

Enjoy the terminal doing its job, casual snap some screenshots to non-IT friends. It scores well. #hackerMan

While the pictures are uploading we will create the AWS Rekognition collection with the following command.

aws rekognition create-collection –collection-id awesome-waldo-collection

After we create our collection and the pictures are uploaded we will use a Python script to add faces to the collection. The script will loop all the pictures in the S3 bucket and send them to the Rekognition collection with the ‘index faces’ operation, when a picture is added to the collection AWS will automatically process it and detect the faces, these faces will be stored in a map which we will be able to query later.

AWS documentation on this operation.

I added a hard-coded counter in this script just to follow progress.

import boto3
from boto.s3.connection import S3Connection

conn = S3Connection()
bucket = conn.get_bucket('awesome-waldo-bucket')
count = 1

for key in bucket.list():
    print("Added " + str(count) + " pictures out of 1697...")
    count = count + 1


Next execute the Python script.

You will find that it takes a very long time to process this number of pictures. For the sake of keeping it simple we did not do any batch processing in this blog but it is possible.

AWS documentation for batch processing.

After the images are done processing find a clear and recent picture of yourself, name it ‘me.png’ and upload it to the S3 bucket.

Be sure that it is a clear picture of your face and that you are the only one in it.
For example.

Now that we have all elements in place we can use the following command to retrieve faces matching our sample.

aws rekognition search-faces-by-image –image ‘{“S3Object”:{“Bucket”:”awesome-waldo-bucket”,”Name”:”me.png”}}’ –face-match-threshold 70 –collection-id “awesome-waldo-collection”

You can play with the ‘—face-match-threshold’ to get more or less correct results. The command will return json containing data on the matched faces.

You can repeat this with different sample pictures of your face to get more results.

And now the moment of truth, as it turns out I was not that popular with the photographers on the festival this year as I’m only in two pictures. Better luck next year!

As you can see, AWS Rekognition is a great service to find yourself in a picture even in a big crowd!

This picture surprised me the most, even when your face is very blury AWS Rekognition can still find you! What a gift of technology indeed!

I hope this blog has given you some insight in the possibilities with AWS Rekognition and wish you the best of luck in finding yourself!

, , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *


Need a hand? Or a high five?
Feel free to visit our offices and come say hi
… or just drop us a message

We are ready when you are

Cloudar NV – Operations

Veldkant 7
2550 Kontich (Antwerp)

info @

+32 3 450 67 18

Cloudar NV – HQ

Veldkant 33A
2550 Kontich (Antwerp)

VAT BE0564 763 890

    This contact form is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

    • SHARE