I tried to detect, analyze and compare faces using Amazon Rekognition

2022.11.29

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

Introduction

In this blog post, I will be showing a demo on the AWS management console on how to the face recognition features in Amazon Rekognition. I will analyze an image with Amazon Rekognition and then compare it to other images to check if the faces are the same.

what is Amazon Rekognition?

Amazon Rekognition is a deep learning-based image and video analysis service. If you are implementing an employee verification system, need to automate video editing, or provide secondary authentication for other applications, you may encounter the difficulty of facial recognition and comparison. You could fix this by creating your own machine learning model, an API, and managing your own infrastructure. This approach is costly, time-consuming, and needs specialized understanding.

An easier method is to utilize Amazon Rekognition, which can recognize faces in images or videos, discover facial landmarks like as eye location, and detect emotions such as joy or sadness in near-real time or in batches without infrastructure or modeling maintenance.

Implementation

Enter the Amazon Rekognition Console

Open the AWS Management Console, then type Rekognition in the search bar.

Analyze Faces

  1. To start, select Facial analysis in the panel navigation on the left. This feature allows you to analyze faces in an image and receive a JSON response.

  1. Open and save the first sample image for this tutorial here.

NOTE: For the reasons of copyright, we will be using images from the AWS sample and not random images online.

  1. Click the Upload button and select the sample image you just saved.

  1. To the right side of the facial analysis, you can see the quick result for each face detected.

Compare Faces

In this stage, you'll utilize the face comparison feature to get the detailed JSON result from comparing two unrelated photographs.

  1. Select  Face Comparison on the left panel

  1. Open and save the second sample image for this tutorial here.

  1. Click on the Upload button for the reference face and select the image you just saved.

  1. To view the JSON results, select the Response dropdown menu. It is worth noting that the "Similarity" score for each of the identified faces is never more than 1.

Compare Faces Again

In this phase, you'll use the face comparison feature to get the detailed JSON result from comparing two photographs that match.

  1. Open and save the third and final sample image for this tutorial here

  1. Take note that the reference face that matched our other photo had a 99% similarity score and determined that none of the other faces was a match.

  1. Click on the Response dropdown to see the details of each comparison.