Image analysis with AWS Rekognition

Image analysis is one of those services with a very high WOW factor. Even if you take your time to study machine learning, deep learning and you are able to do your bits and pieces in this new brave world, your are still likely to get surprised by the capabilities. The big cloud providers analyze many millions of photos on a daily basis and the bigger the data set becomes the more predictive power it will gain.

At Pied Piper we will be mostly using these and other readily available capabilities for our team projects as opposed to build our own models. And of course we can do all this from the comfort of Python which we can easily integrate with other elements like Cloud Native Applications and Internet of Things for whole end-to-end solution.

AWS rekognition offers the following services:
  • Object and scene detection. It provides a confidence score for each object it detects
  • Facial analysis. Locates faces in an image and provides face attributes and emotions
  • Face comparison. It provides a similarity score
  • Facial recognition. Finds similar faces in a large collection of images
  • Celebrity recognition. Recognizes faces from a large collection of famous individuals
  • Image moderation. It identifies content deemed not appropriate for certain audiences, to make it easy for apps to filter it
I have played and provided Python code for the first 3 services which are the ones that interest me the most. However I have found that all three use very similar workflow, so I would expect the remaining 3 services will be very similar too. The code can be found in the following Github repository


For both the object and face detection use cases I have provided two different Python scripts: a simple script for a single photo, and another one to analyze a whole bucket. Use the second one with caution.

As in the previous post where we discussed the AWS Polly service, you are going to need:
  • AWS credentials (access key and secret key). The Github repository provides more details on how to make those accessible to the Python script
  • Boto3 module. Install it with "pip install boto3"
  • S3 Bucket with photos
Rekognition integrates very easily with S3. You can point the script to specific buckets or to specific photos sitting on S3 for them to analyzed. It can also integrate with Lambda (I will discuss Lambda in a future post) to for example trigger a function when a new photo is uploaded to a bucket so that Rekognition can tag it.

For more details about AWS Rekognition with Boto3 visit:

http://boto3.readthedocs.io/en/latest/reference/services/rekognition.html


Comments

Popular posts from this blog

Sending PowerStore alerts via SNMP

Sending PowerStore logs to Syslog

Electronic Nose - eNose