Face detection and matching, using Amazon Image Rekognition

Face detection and matching, using Amazon Image Rekognition

October 1, 2018 / Eternal Team

As of May 2018 the population score of our world “Earth” has reached 7.6 billion. That means there are exactly 7.6 billion faces all around the world. This huge populace has resulted in various challenges and one of them is keeping track of each one.

Over the years many methods have been developed and tested to solve this issue. The advent of cloud technology is up-to its hills for solving this issue. The leader of cloud server technology AWS has come up with Amazon Rekognition to solve all of face matching issue. Eternal is an AWS partner and implements the latest Amazon technologies to solve custom software development needs. With Eternal and Amazon Rekognition you can get implemented face detection in your custom software in a snap (Just kidding :), it will take more time than snap).

Aws services that we have used

  1. S3
  2. Amazon Cognito
  3. Lambda Function
  4. Amazon Rekognition
  5. Amazon API Gateway

Purpose of the services

  • S3 This services use to store image and search image.
  • Amazon Rekognition This services use to detect faces. AWS rekognition compare two images ( faces in our case ) and co-related both faces in terms of various co-ordinates and generate result json.
  • Lambda Function This function use to upload image in S3 and other use to compare faces.
  • Amazon Cognito This services provides authentication, authorization, and user management for your web and mobile apps.it’s provides to pool id then use it web application.
  • Amazon API Gateway This services use to get search results ( image ) and display images to web browser using lambda function.

What you can do

First you create an album ( no of photos ) from which you would like to compare single photo. Say for example you have already database of 50 faces available in a single album, so first have to create album and upload no of photos.
After your photo database is ready, you can supply single photo with the face/faces and system will identified the faces from all photo album and give you no of photos with matched face/faces.

All the technical stuff begins here

Collection Amazon rekognization store information about detected faces in server side container which is called collection.
IndexFaces Index created for individual face.
SearchFaceByImaage Supply an Image ,It search & returns Similar faces from the Collection based on supplied reference image.

Create Collection

  • Create an empty collection
  • A collection must be create before calling inexFaces API
  • Collection Names are case-sensitive
  • A collection can store millions of faces

List Collection

  • Return list of collection IDs create in your account

1. Go to AWS console management to create a S3 becket and its permission. It’s important that s3 bucket has sufficient read write permission to perform operation.

a. Create s3 bucket.
b. Change policy.
c. Click on bucket policy to read and write operation

d. Click on CORS configuration to allow all REST method to any domain.

2. Go to AWS console management then go to lambda functions and create lambda function (Node js 6.10).
Below code generate collectionID when upload a photo on s3 bucket.

a. Add S3 bucket event.
b. S3 bucket name enter and event type select is Object Created.
c. Then select lambda function then wirte a code

(NOTE: change collectionName ,Bucket regions and lambda regions at same ,This bucket to store all image)

From above code, now photo album is ready with a collection. Again let me recall that collection is a collection of indexFaces. So now collection of photos are ready.

3. Supply photos for search.

Go To AWS console management then go to S3 bucket and create new backet to use Repository for search input images.

a. Click on created S3 bucket then click on Permission.
b. Click on bucket policy to read and write operation

c. Click on CORS configuration to allow all REST method to any domain.

4. Create Lambda function for compare and searching image from collection.

a. SearchImage(node js.6.10)

5. Create an API in Amazon API Gateway.API exposing ‘your lambda function’ to clients.

6. Create html page.

ImageSearching.html

(Note change poolid for IdentityPoolId insert your poolid ,and change bucket name change url (var url =’’) insert your apiGetWay url and change (imageurl)

Amazon face rekognization and face matching functions are ready to use.

Related Blogs

blog

March 14, 2019

Configure Instance Security-Group for WHM compatib...

Sharing is caring!

Here, we will see the ports that we need to be configured for WHM to function properly and a…..

blog

February 26, 2019

DNS – What it is, How it Works?...

Sharing is caring!

We go through the basics regarding what is a domain; what is a DNS Service; the basic require…..

blog

February 25, 2019

AWS Route-53 : The Swiss Knife for Domain Hosting...

Sharing is caring!

The general idea regarding ROUTE-53 is that it is a Domain hosting service, which is true. But, it provides…..

Want to start a project?

It’s simple.

Contact us