Amazon Rekognition API Example

David Wallin
3 min readApr 3, 2017

--

A few months ago, Amazon unveiled their new AI offering. This is a small collection of high level API’s including image recognition and classification, machine learning, text to speech, and conversational interfaces like Alexa (though that last one is still in private beta). These API’s provide a simple, high level way for developers to start integrating AI features without spending months trying to implement their own, or trying to integrate complex packages like Tensorflow into their application.

I was most interested in trying out the image recognition API (Amazon Rekognition) to see if it could recognize fellow employees based on their headshot. Amazon does have docs online, but no complete Rekognition samples specifically for Node.js, and figuring out how to upload local images took a little digging. I’ve uploaded my example project to Github which has code to take a folder of images, index them into an AWS Recognition collection, and then a very basic API endpoint and test form for uploading images to the endpoint. Feel free to use it as a base for your own experiments.

The way face search works with AWS, you must first create a collection to hold your group of faces that you want to search. Then each face must be indexed in that collection. I’ve included code that will load a folder of images and index them into the collection of your choosing.

Assuming you’ve followed the instructions in the README, you should see this form:

If you visit the index page on a mobile phone, it has the correct HTML5 attribute to allow you to capture an image using the camera (accept=”image/*;capture=camera”). After you press submit, you’ll see something like this:

(re-formatted for readability)

The ExternalImageId should match the name of the image we originally indexed. I tested it with about 10 people here in the office and it was correct on 90% of them. On one person, it didn’t return any results (probably because he wasn’t wearing glasses in his headshot). It would probably be more accurate if I indexed multiple pictures of each person instead of just one, so we can’t really consider this a great test, only a proof of concept.

We have a lot of fun ideas for things we can do with the technology now that we have the basics working, like playing someone’s personal theme music when they walk in, or recognizing clients and directing them to the correct conference room etc.

Learn more about Archer’s labs projects on our website! Once again, the code for this project is available here.

--

--

David Wallin

I work as a researcher and developer at The Archer Group (http://www.archer-group.com) and work on games and music apps in my spare time.