Face detection and matching, using Amazon Video Rekognition

Face detection and matching, using Amazon Video Rekognition

October 12, 2018 / Eternal Team

Face detection is the latest cutting-edge computer technology that is being used in a variety of applications to identify human faces in digital images and streaming videos. With the increase in IT and IP security organizations, face detection through live videos has become the industry standard for IT security firms.

Face detection and recognition has found its huge implementation in social media and a variety of other applications. In this blog post, we are going to talk about how you can get a super-accurate facial recognition enabled application in just a few hours, with a little investment, Eternal’s Amazon Video Rekognition expertise and some cups of coffee.

Aws services that we have used

  1. S3
  2. Amazon Cognito

Purpose of the services

  • S3 This services use to store video.
  • Amazon Rekognition This services use to analyze videos. AWS rekognition you can detect images ( faces in our case ) and generate result json.

What you can do

First you create an S3 bucket to upload an .mp4, .mov or .avi format video file to your S3 Bucket then using Amazon Rekognition video api.

All the technical stuff begins here

Create Collection

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

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.Starts asynchronous detection of faces in a stored video.

Amazon Rekognition Video can detect faces in a video stored in an Amazon S3 bucket. Use Video to specify the bucket name and the filename of the video. StartFaceDetection returns a job identifier (JobId ) that you use to get the results of the operation. When face detection is finished, Amazon Rekognition Video publishes a completion status to the Amazon Simple Notification Service topic that you specify in NotificationChannel . To get the results of the label detection operation, first check that the status value published to the Amazon SNS topic is SUCCEEDED . If so, call and pass the job identifier (JobId ) from the initial call to StartFaceDetection .

  • create a Python script to return JobId

3.Gets face detection results for a Amazon Rekognition Video analysis started by .
Face detection with Amazon Rekognition Video is an asynchronous operation. You start face detection by calling which returns a job identifier (JobId ). When the face detection operation finishes, Amazon Rekognition Video publishes a completion status to the Amazon Simple Notification Service topic registered in the initial call to StartFaceDetection . To get the results of the face detection operation . If so, call and pass the job identifier (JobId ) from the initial call to StartFaceDetection.

GetFaceDetection returns an array of detected faces (Faces ) sorted by the time the faces were detected.
Use MaxResults parameter to limit the number of labels returned. If there are more results than specified in MaxResults , the value of NextToken in the operation response contains a pagination token for getting the next set of results. To get the next page of results, call GetFaceDetection and populate the NextToken request parameter with the token value returned from the previous call to GetFaceDetection .

create a python script to detect Face

Want to start a project?

It’s simple.

Contact us