Face recognition of celebrities with Amazon Rekognition

As stated on the Amazon Web Services website, Amazon Rekognition is a service that enables you to add image analysis to your applications. With Rekognition, you can detect objects, scenes, and faces in images. Among the most important features offered by Amazon Rekognition are:

  • Objects and Scene Detection

  • Moderation of Images

  • Facial Analysis

  • Facial Recognition

  • Celebrity Recognition

In this technical example, we’re going to use Java SDK to show how to develop a simple and useful application that recognizes celebrities faces in order to demonstrate the capabilities of the service.

AWS Rekognition results

We picked various pictures of recognized celebrities like Cristiano Ronaldo, Celine Dion and Sting, obtaining favorable results as showed in the infographic.

For the technical side, we will focus on the most important steps and will omit the less-specific parts (you can get all the code at Github).


1) Create an Amazon Rekognition client using the AmazonRekognitionClientBuilder including the Region to be used and a RecognizeCelebritiesRequest containing the representation in bytes of the picture.

AmazonRekognition amazonRekognition = AmazonRekognitionClientBuilder

RecognizeCelebritiesRequest request = new RecognizeCelebritiesRequest()    .withImage(new Image().withBytes(imageBytes));

2) Create a RecognizeCelebritiesResult object that will contain the obtained results:

RecognizeCelebritiesResult result = amazonRekognition.recognizeCelebrities(request);

3) Display the recognized celebrity information

List celebs=result.getCelebrityFaces();    
System.out.println(celebs.size() +  celebrity(s) were recognized.\n”);    
List metadata = new ArrayList();      

for (Celebrity celebrity: celebs) {  
// Name        
System.out.println(“Celebrity recognized:  + celebrity.getName());   metadata.add(“Celebrity recognized:  + celebrity.getName());   
// Id        
System.out.println(“Celebrity ID:  + celebrity.getId());        
metadata.add(“Celebrity ID:  + celebrity.getId());               
// Extra info        
System.out.println(“Further information (if available):);       
metadata.add(“Further information (if available):); 
for (String url: celebrity.getUrls()){           

Currently, Amazon Rekognition only supports JPG and PNG formats, which is a disadvantage compared to Google Cloud Vision that provides support for a wide range of formats such as GIF, BMP and RAW among others. However, it should be noted that during the tests performed there were no performance issues due to the type of format, but if greater effectiveness of the tool could be observed when the faces are clearly visible or at frontal angle and when the contrast with the background is notorious.

Another feature to note is that the API was designed to include as many celebrities as possible based on feedback from AWS clients, so new names are constantly being added to the list after some analysis. Taking this into consideration, we did some extra testing using celebrity images from countries like Panama and Colombia to diversify the evidence based on a wider cultural spectrum. The results we obtained were as follows:

In the first two tests satisfactory results were observed, the tool was able to recognize Panamanian boxing legend Roberto Durán and the well-known Colombian footballer of Bayern Münich, James Rodriguez. We did a third test, using lower resolution image to test the limits of the tool and did not get favorable results when trying to recognize the great martial artist of all time, Bruce Lee. 


Taking these results into account, it can be affirmed that the quality and resolution of the image are an aspect to consider when using the tool. If it is desired to obtain favorable results, it is important to ensure the use of images of considerable quality, taking into account that the service still seems to be developing improvements as the Deep Learning models are fed.

Amazon rekognition

Although Amazon Rekognition is relatively new to the market, we were impressed by its capabilities, competitive pricing and features. There’s a great potential for Rekognition to become a standard for image analysis based in Deep Learning algorithms, along with competing services like Clarifai and Google’s Vision API.

The near future looks very promising for software development focused on Artificial Intelligence, a market that will definitely open new horizons for the creation of impressive tools that could have a beneficial impact on our society.