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 the 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 (1)


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 .standard() .withRegion(Regions.US_WEST_2) .build();  

  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()){           





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.