Face detection was never this simple!


What is AWS Rekognition ?

Amazon Rekognition is an AWS service that makes it really easy for you to enable image analysis in your applications. With Rekognition, you can detect objects, scenes or faces and label them;recognize celebrities; and identify inappropriate content in images.

You can also search and compare faces,something which can be implemented for use cases such as employee verification and marking attendance. Rekognition’s API enables you to quickly add sophisticated deep learning-based visual search and image classification to your applications.

(Excerpt taken from https://aws.amazon.com/rekognition/)

Rekog is a result of decade long research and deep learning of billions of images.

What does it have in store for us?

1) How easy is it to implement the API?

I made use of the AWS SDK which made this super simple. Let me give you an example of the code that would provide image recognition for you and label them:

DetectLabelsRequest request = new DetectLabelsRequest()
        .withImage(new Image()
                .withBytes(imageBytes))
        .withMaxLabels(20)
        .withMinConfidence(50F);

try {

    DetectLabelsResult result = rekognitionClient.detectLabels(request);
    List  labels = result.getLabels();

    System.out.println("Detected labels for " + photo);
    for (Label label: labels) {
        System.out.println(label.getName() + ": " + label.getConfidence().toString());
    }

} catch (AmazonRekognitionException e) {
    e.printStackTrace();
}

2) How reliable is it?

I’ve tested it with DetectLabels and SearchFacesByImage(face recognition) and can only talk from my experience, but it is pretty damn reliable. You can change the `ConfidenceThreshold` to allow flexibility around this, but I found that 90% was a good match for taking various images in diverse environments.

3) Is it scalable?

Absolutely.

With Amazon Rekognition, you only pay for the number of images you analyze and the face metadata you store.I’m availing the free tier usage as of now.

As with all AWS services, you pay for Rekognition on the tiered pricing model.

What can it do?

Common use cases for using Amazon Rekognition include the following:

  • Searchable image library – Amazon Rekognition makes images searchable so you can discover objects and scenes that appear within them.
  • Face-based user verification – Amazon Rekognition enables your applications to confirm user identities by comparing their live image with a reference image.
  • Sentiment and demographic analysis – Amazon Rekognition detects emotions such as happy, sad, or surprise, and demographic information such as gender from facial images.
  • Facial recognition – With Amazon Rekognition, you can search your image collection for similar faces by storing faces, using the IndexFaces API operation. You can then use the SearchFaces operation to return high-confidence matches. A face collection is an index of faces that you own and manage. Identifying people based on their faces requires two major steps in Amazon Rekognition:
    1. Index the faces.
    2. Search the faces.
  • Image Moderation – Amazon Rekognition can detect explicit and suggestive adult content in images. Developers can use the returned metadata to filter inappropriate content based on their business needs. These labels indicate specific categories of adult content, thus allowing granular filtering and management of large volumes of user generated content (UGC). For example, social and dating sites, photo sharing platforms, blogs and forums, apps for children, e-commerce sites, entertainment and online advertising services.
  • Celebrity Recognition – Amazon Rekognition can recognize celebrities within supplied images. Rekognition can recognize thousands of celebrities across a number of categories, such as politics, sports, business, entertainment, and media.

Amazon Rekognition : How It Works

The computer vision API operations that Amazon Rekognition provides can be grouped in the following categories:

  • Non-storage API operations – The API operations in this group do not persist any information on the server. You provide input images, the API performs the analysis, and returns results, but nothing is saved on the server. The API can be used for operations such as the following:
    • Detect labels or faces in an image. A label refers to any of the following: objects (for example, flower, tree, or table), events (for example, a wedding, graduation, or birthday party), or concepts (for example, a landscape, evening, and nature). The input image you provide to these API operations can be in JPEG or PNG image format.
    • Compare faces in two images and return faces in the target image that match a face in the source image.
    • Detect celebrities in images.
    • Analyse images for explicit or suggestive adult content.
  • Storage-based API operations – Amazon Rekognition provides an API operation that detects faces in the input image and persists facial feature vectors in a database on the server. Amazon Rekognition provides additional API operations you can use to search the persisted face vectors for face matches. None of the input image bytes are stored.

Rekognition in Action

The next question arises: how do we quickly set it up and get it working.AWS Rekog provides a free usage of upto 5000 API calls and upto 1000 images to be indexed (both limits on a per month basis).You would just need to signup for AWS and avail these under free tier usage.

I will be adding a detailed post on setting up Rekognition soon.For now, we’re going to see it in action.Check out the below video:

References: https://aws.amazon.com/documentation/rekognition/
Advertisements

About Abhinav Sinha

Sr. Software Consultant
This entry was posted in Scala. Bookmark the permalink.

One Response to Face detection was never this simple!

  1. Bharat Singh says:

    Reblogged this on Bharat Singh and commented:

    Face recognition using Amazon AWS Rekognition !!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s