Amazon Rekognition is a service that makes it easy to add image analysis to your applications.

Using AWS Rekognition, you can build applications to detect objects, scenes, text, faces or even to recognize celebrities and identify inappropriate content in images like nudity for instance.

Rekognition allows also the search and the detection of faces.

It’s a cloud-managed service, that has different SDKs for many programming languages:

You can also search and compare faces. Rekognition’s API enables you to quickly add sophisticated deep learning-based visual search and image classification to your applications.

Let’s create our virtual environment for our Python example and install Boto3 library as well as requests since we’re going to read online images:

mkdir rekognition_example

cd rekognition_example/

virtualenv -p python3 venv

. venv/bin/activate

mkdir app

cd app

touch app.py

pip install boto3

Download our mini ebook 8 Great Tips to Learn AWS.

Who’s There !?

This is a simple code in order to detect faces in an image.

This is the image we’re going to use:

Stephen Hawking, David Fleming, Martin Curley. source: wikimedia

import boto3, requests

session = boto3.Session(profile_name='default')

rekognition = session.client('rekognition')

response_content = response.content response = requests.get(' https://upload.wikimedia.org/wikipedia/commons/thumb/8/88/Stephen_Hawking_David_Fleming_Martin_Curley.png/640px-Stephen_Hawking_David_Fleming_Martin_Curley.png' response_content = response.content rekognition_response = rekognition.detect_faces(Image={'Bytes': response_content}, Attributes=['ALL'])



print(rekognition_response)

Executing this code will give you a dict as an output. I am not going to copy paste it, a screenshot would be better :-)