Besides being a techy, I dabble in the occasional run at 5k & 10k distances. In many races, photographers will capture you, usually in some very un-flattering pose. The problem is that there can be hundreds of photos to check through – sometimes thousands.

Solution – AWS Rekognition

Recently, AWS announced several AI services around image processing. Rekognition was one of the services and I’d been looking for a realistic test other than identifying hotdogs.

As an API based service, Rekognition doesn’t need lambda or EC2 instances, although of course they can take advantage of the service. Given an image (and more recently) videos, AWS Rekognition can be used in several ways:

  • Identify objects and text within an image
  • Identify face – identifying celebrities or comparing against known faces.
  • Facial analysis – identify gender, emotion, gender and features.

I put together some code which could take the photos from a race and check if any managed to include me (or anyone with a specific race number).

But first, a quick example of how to use Rekognition.

Basic example

I’m tending to use Python a lot for development these days, and luckily there is an AWS SDK called boto3 which gives access to the various api services available from AWS. Similar SDKs are available for Node, Java and Javascript. Boto has interfaces to virtually all of the AWS services; if you have it already installed and can’t find an interface for Rekognition, make sure you’re running version 2.7 or greater.

Using Rekognition with boto is extremely simple; setup authentication as described in the documentation (or use my virtualaws tool that builds on virtualenv); create a session to connect to AWS and then make a call to the required service – a very simple example might look like:

Running vest with number

This will return data from Rekognition in JSON – the image to the right, returns something like

The JSON shows that Rekognition recognises the vest number even with the glare over the image. The data also provides a confidence rating and data about where the text can be found within the image; the detect_text call and the response returned can be found in the boto documentation.

Processing race images

The example above shows how simple it can be to identify a vest number from an image, but how to process 100’s of photos from a race day? Providing you have a list of images URLs, the code below can be used to identify the race numbers in the images:

The code above will output JSON listing the vest numbers found. The data returned also contains a list of matching images and a confidence level for each image.


According to the AWS pricing page, it currently costs $1 per 1000 images processed – I’m assuming this is actually per API call rather than actually per image, but could be wrong on that.

Updated 26/04: Added pricing info