Predictive Hacks

Example of Celebrity Rekognition with AWS

rekognition

Rekognition with Console

Amazon Rekognition gives us the chance to recognize celebrities in images and videos. For our example, I will choose the images of Antentokounmpo Brothers and we will see if the Rekognition can recognize them.

Giannis Antetokounmpo Brothers: All You Need To Know – SportyTell
Image Address

You can try this image in the AWS Console. Let’s see what we get:

Example of Celebrity Rekognition with AWS 1

As we can see, it managed to detect Giannis and Thanasis Antentokounmpo! The rest brothers should wait until they become true celebrities apparently 🙂

Rekognition with boto3

We can get call the API via Python and boto3 and we can get all the info from the API response which is in json format. We will provide an example of how you can simply get the name of the celebrities. We will work again with the same image.

import boto3
import json

# create a connection with the rekognition
client=boto3.client('rekognition')


#define the photo
photo = "Giannis-Antetokounmpo-Brothers.jpg"

# call the API and get the response
with open(photo, 'rb') as image:
    response = client.recognize_celebrities(Image={'Bytes': image.read()})
    
for celebrity in response['CelebrityFaces']:
    print ('Name: ' + celebrity['Name'] + ' with Confidence: ' + str(celebrity['MatchConfidence']))
 

Output:

Name: Thanasis Antetokounmpo with Confidence: 58.999996185302734
Name: Giannis Antetokounmpo with Confidence: 57.0

Notice that the response contains much information like the Bounding Boxes etc.

As you can see we used the boto3, if you want to learn more about it you can have a look at the Basic Introduction to Boto3

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email

Leave a Comment

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

data science journey
Miscellaneous

My Journey as a Data Science Blogger

Μy Background My Studies Back in 2001, I entered university to study Statistics. During my first year, I ran my