AWS, Cloud Computing

4 Mins Read

Selfie Based Face Identity Verification using Amazon Rekognition

Voiced by Amazon Polly

Introduction

In-person Verifying and validating a person’s identity is a slow, time-consuming process and costlier. Our day-to-day activities are modernized or handled electronically instead of through traditional in-person systems. Nobody wants their actions to be outdated or slow when time is seen as money in the modern world. As speaking into it, this blog will discuss the quick, accurate Selfie based face identity verification system leveraging deep learning and artificial intelligence through Amazon Rekognition.

Freedom Month Sale — Upgrade Your Skills, Save Big!

  • Up to 80% OFF AWS Courses
  • Up to 30% OFF Microsoft Certs
Act Fast!

Identity

Every citizen is identified/verified by a unique identity provided by the government. It differs from country to country and has various types of the identification system. Generally, we are well organized in India, and we have been provided a 12-digit unique identification number provided by the Government of India not only limited to Aadhaar but also other types of identity cards like Driving Licenses, Voter ID, Passports, etc.

Identity Verification System

Businesses commonly use an Identity verification system, institutions, or e-commerce companies anywhere transaction is made, banking, social media, etc. To ensure the user provided information validly matches the identity of that person or user.

Amazon Rekognition has a pre-trained facial way of identity system that leverages Artificial Intelligence to recognize and understand facial data quickly, accurately, and cheaply. This replaces human workflow by building an intelligent system that verifies a person’s identity in a fraction of second.

Input to CompareFaces API

CompareFaces API takes two required arguments one is the source, and another is a target.

Source: Identity with face present in it (Required)

Target: Facial Image (Required)

Threshold: By default, the similarity threshold is set to 80. This means it returns only the face of the response greater than 80% of similarity. (Optional)

QualityFilter: It filter outs the input image based on filter type [ AUTO, LOW, MEDIUM, HIGH]. By default, it’s NONE. If you choose AUTO, then Amazon Rekognition will automatically choose the filter.

If the mentioned filter is not matched, then Amazon Rekognition won’t compare the faces.

Note: Input of source and target can be passed as base64 image byte or an s3 object. If the source image has multiple faces, it takes one largest face and compares it with each face detected in the target image.

On a given facial photo and identity where the user’s face is presented to Amazon Rekognition compareface API, the facial pattern of the Selfie or face is automatically recognized first and then compared with the face present in the Identity—for example, given an image of license identity with image present in it as source and target as facial image as shown below.

Note: If there are multiple faces in the source image, then the rekognition takes the largest images. And if using CLI, you will have to give input image in PNG or JPEG format.

Response of CompareFaces API

The API responds with an array of face matches arranged in decreasing order of similarity score. It also gives a bounding box of the key facial landmarks, information on pixels like radiance, contrast, intensity, etc., and a confidence level for each face match. A similarity score indicates how closely the faces resemble one another.

The primary response will have a Similarity score, face landmark bounding box coordinates, confidence score, landmark of different types such as [ left eye, right eye, left mouth, right mouth, nose], pose of roll, yaw, pitch, and for representing quality it has brightness and sharpness.

Note: Here confidence score is different from the similarity score. The Confidence score expresses the amount of confidence that the enclosing box includes a face, whereas the similarity score says how close the face matches.

Sample Input and output response

Input from Management Console:

 

rek1

Fig 1: In the above figure you can see the Source I uploaded is my PAN (Permanent Account Number); for Target, I had my Selfie to the API.

Even though the quality of 1st image face is poor, Amazon Rekognition has found a similarity score of 99.8 %.

Output Response :

Reference Code

If you want to try this via API cal using AWS lambda, there is a simple direct reference code below. For now, I have uploaded the image to my S3 bucket.

Lambda_function.py

rek2

Fig 2 – In the above figure, you can see the execution results of the Lambda Code

Conclusion

We could see how Amazon Rekognition helps quickly design and create a selfie identity verification system.  We have understood the different input configurations and output responses as well. Since Amazon Rekognition is a fully managed AWS service, without any worries, this feature can be designed and deployed at any scale.

Freedom Month Sale — Discounts That Set You Free!

  • Up to 80% OFF AWS Courses
  • Up to 30% OFF Microsoft Certs
Act Fast!

About CloudThat

CloudThat is an award-winning company and the first in India to offer cloud training and consulting services worldwide. As a Microsoft Solutions Partner, AWS Advanced Tier Training Partner, and Google Cloud Platform Partner, CloudThat has empowered over 850,000 professionals through 600+ cloud certifications winning global recognition for its training excellence including 20 MCT Trainers in Microsoft’s Global Top 100 and an impressive 12 awards in the last 8 years. CloudThat specializes in Cloud Migration, Data Platforms, DevOps, IoT, and cutting-edge technologies like Gen AI & AI/ML. It has delivered over 500 consulting projects for 250+ organizations in 30+ countries as it continues to empower professionals and enterprises to thrive in the digital-first world.

FAQs

1. What is CompareFaces API?

ANS: – A CompareFaces API that measures the two faces in the image are of the same person. This helps to verify a person’s identity against the person’s photo in real-time.

2. What happens if I have multiple faces in Source Image?

ANS: – You can have multiple images in the source image, but the image with the largest face will be taken as a source by CompareFaces.

3. How many faces can be compared in the target image?

ANS: – It can compare a face in the source image up to 15 faces in the target image.

WRITTEN BY Ganesh Raj

Ganesh Raj V works as a Sr. Research Associate at CloudThat. He is a highly analytical, creative, and passionate individual experienced in Data Science, Machine Learning algorithms, and Cloud Computing. In a quest to learn and work with recent technologies, he strives hard to stay updated on advanced technologies along efficiently solving problems analytically.

Share

Comments

    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!