Understanding AWS Rekognition for visual detection in Images

Vikrant thakur
4 min readMay 11, 2021

AWS Rekognition working overview

Icon Of AWS Rekogniion

Introduction:

Face recognition is a method of identifying or verifying a person’s identity using his or her face. Face detection systems can be used to identify people in photos, video, or real-time. Law enforcement can also use mobile devices to identify people when police stop.

But facial recognition data can be flawed, which can affect people for crimes they did not commit. Recognition software is very bad at identifying African Americans and other minority races, women, and young people, often unfamiliar with or unable to identify them, affecting certain groups differently.

Amazon Rekognition is a service that makes it easy to add powerful visual analysis to your apps. Rekognition Image lets you easily build powerful applications to search, verify, and edit millions of images. Video Recognition allows you to extract motion-based content from saved or live streaming videos and helps you analyze them.

Rekognition Image is an image recognition service that detects objects, scenes, and faces; extracts text; sees celebrities, and identifies inappropriate content in photos. It also allows you to search and compare faces. Rekognition Image is based on the same proven, awesome, in-depth reading technology made by Amazon computer scientists to analyze billions of images daily for Prime Photos.

Rekognition Image uses in-depth neural network models to find and label thousands of objects and scenes in your photos, and continuously add new labels and service recognition features. With Rekognition Image, you only pay for the images you analyze and the face metadata you save.

AWS Rekognition Overview:

Amazon Rekognition is directly integrated with Amazon Augmented AI (Amazon A2I) so you can easily move low-level predictions from Amazon Rekognition Image to human reviewers. Using the Amazon Rekognition API for a content rating or the Amazon A2I console, you can specify instances where Amazon A2I submits analytics forecasts, which could be a confidence guarantee or a random sample percentage. If you specify a confidence limit, Amazon A2I only directs those predictions that fall under the threshold of human reviews. You can adjust these thresholds at any time to achieve the right balance between accuracy and cost-effectiveness. Alternatively, if you specify a sample percentage, Amazon A2I delivers a random sample of individual review predictions. This can help you to use auditing to monitor the accuracy of regular predictions. Amazon A2I also provides reviewers with a web interface that contains all the instructions and tools they need to complete their review tasks. For more information on launching personal reviews with Amazon Rekognition, see the Amazon A2I web page.

One can visit this website for more information:

https://aws.amazon.com/rekognition/

Uses of Rekognition:

There are plenty of services that one can use in AWS Rekognition. Most of them are really easy to use and one does not need to know about deep learning modeling to use them. AWS has already has done it and created automated services for such tasks.

The most commonly used Rekognition Image features include:

· Searchable Library

· Face-Off User Verification

· Sensory Analysis

· Admission

· Image measurement

Most commonly used Recognition Video features include:

· The search index for video storage

· Easy video filtering for explicit and sexually explicit content

How to use:

Setting up AWS recognition

Unlike other AWS services, there is no re-recognition console interface, other than demo. While demos can be used for trial tests, they are not for use of the app.

Setting up Rekognition includes accessing AWS, downloading the Software Development Kit (SDK) for the programming language you want, and using your code.

Although there are some limited connections to AWS Rekognition in the AWS Console, using Rekognition is done via SDK.

When using the SDK, the image and video can be sent directly via the API phone, or by transferring the URL to an object stored in S3. When you add image bytes to an API, the image must have a Base64 encode, which is automatically created for you in other languages. If you are transferring an S3 Object, then it is not necessary to perform Base64 encoding.

Sample Code:

import os
import sys
import boto3

def detect_labels_local_file(photo):
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)

client = boto3.client(‘rekognition’)

with open(photo, ‘rb’) as image:
response = client.detect_labels(Image={‘Bytes’: image.read()})

print(‘Detected labels in ‘ + photo)
for label in response[‘Labels’]:
print (label[‘Name’] + ‘ : ‘ + str(label[‘Confidence’]))

return len(response[‘Labels’])

def main():
photo=’dscf5559.JPG’

label_count=detect_labels_local_file(photo)
print(“Labels detected: “ + str(label_count))

if __name__ == “__main__”:
main()

Sample Ouput:

$ python3 rekog1.py
Detected labels in dscf5559.JPG
Walkway : 99.99960327148438
Path : 99.99960327148438
Sidewalk : 99.81764221191406
Pavement : 99.81764221191406
Person : 99.6449966430664
Human : 99.6449966430664
Cobblestone : 92.26229095458984
Furniture : 87.95263671875
Bench : 87.95263671875
Porch : 82.72274780273438
Road : 59.49223327636719
Patio : 55.43474197387695
Labels detected: 12
$

Other recognition clouds:

There are many options to AWS Rekognition one of them includes Microsoft’s Azure Face API. We will discuss it in the next article

Conclusion:

This article explored what image recognition is, why it is difficult to use it internally, what AWS Rekognition is, and several examples of applications in the same field.

However, the possible use of AWS Rekognition extends beyond what I have discussed here. In addition to drugs, re-identification can be used in private vehicles, in robot view, to detect unsafe user-generated content, face recognition comparisons, testing, law enforcement, and more.

Anyone with a need to analyze photos or video needs to thoroughly explore the power of AWS Rekognition through their app.

--

--