AWS Rekognition

AWS Rekognition makes it easy to perform intelligent image/video analysis. You can use the API to quickly identify objects, people, text, scenes, and activities. It is based on the deep learning technology.

You can check out the service here https://aws.amazon.com/rekognition/

If you have an AWS account. You can use AWS Python SDK boto3 to call Rekognition API. Here is an example to compute image similarity between two images.

First install boto3. See install documentation http://boto3.readthedocs.io/en/latest/guide/quickstart.html

pip install boto3

Then run the following codes

import boto3
import pprint

THRESHOLD = 85.0
client = boto3.client('rekognition',region_name='us-east-1')

with open('PATH_TO_FIRST_IMAGE.jpg','rb') as first_image:
  image1_bytes = first_image.read()

with open('PATH_TO_SECOND_IMAGE.jpg','rb') as second_image:
  image2_bytes = second_image.read()

response = client.compare_faces(
   SourceImage={ 'Bytes': image1_bytes },
   TargetImage={ 'Bytes': image2_bytes },
   SimilarityThreshold=THRESHOLD)
pprint.pprint(response)

You should see the response as follows if the call succeeds.

Screen Shot 2018-05-20 at 11.40.45 PM

Join our AI for Mankind meetup group.

Screen Shot 2018-05-25 at 8.25.39 AM

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s