Using Amazon Rekognition Custom Labels to detect Idli’s, Car models and more ;-)

Mani
4 min readDec 13, 2019

AWS recently announced “Amazon Rekognition Custom Labels” — where “ you can identify the objects and scenes in images that are specific to your business needs. For example, you can find your logo in social media posts, identify your products on store shelves, classify machine parts in an assembly line, distinguish healthy and infected plants, or detect animated characters in videos.” — https://aws.amazon.com/blogs/machine-learning/announcing-amazon-rekognition-custom-labels/

I am not an Data Scientist or an ML guru, a mere Solution architect who wants to help solve customer problems. One such gap with customers, especially old school companies and smaller outfits, is the lack of deep Data Science skills. This prevents them from leveraging the exciting advancements in Machine Learning including the usage of various ML algorithms, using newer server instance types tailor-made for ML and other ML services like Amazon Sagemaker that are available in public cloud providers like AWS.

AWS has a bunch of services to cater to this segment of customers, where higher level AI services, where customers can do image and video analysis, natural language processing, personalised recommendations, virtual assistants, and forecasting to your applications and others without deep expertise in machine learning. Each of the services can be used standalone, or you can use them in concert to create sophisticated human-like functionality. Either way, you get instant access to fast, high quality AI tools based on the same technology used to power Amazon’s own businesses.

From https://aws.amazon.com/machine-learning/ai-services/ the services in this portfolio looks like this as of December 12th 2019:

AWS AI Services portfolio

Amazon Rekognition Custom Labels Proof of concept

One of the biggest asks from customers who use Amazon Rekognition, was to identify objects and scenes in images that are specific to their business needs. This is the need, which the new Rekognition custom labels feature hopes to solve !!

I saw this short but awesome tweet thread by Matteo Figus on twitter https://twitter.com/matteofigus/status/1203117882604949504 where he used the custom label feature to detect a “Proper Pizza” or not ;-)

I wanted to try the same with a couple of use-cases specific to India — to detect the Indian dish — Idli — https://en.wikipedia.org/wiki/Idli and to find out if the car was was from one of India’s iconic brands — Maruti Suzuki — https://en.wikipedia.org/wiki/Maruti_Suzuki !!

The process is fairly straightforward and remains the same for both use-cases and is well documented — https://docs.aws.amazon.com/rekognition/latest/customlabels-dg/what-is.html and I could complete the whole exercise in a few hours.

Step 1 — Create the Datasets for Idli and Cars

My dataset was woefully inadequate, just between 20–30 images, please use a much larger data set in the real-world (it says typically a few hundred images or less as per the do). The F1 score improves much better with a larger and varied dataset — https://docs.aws.amazon.com/rekognition/latest/customlabels-dg/tr-improve-model.html.

I created two datasets, for Idli’s and for cars with images found from the web. I created labels, created the bounding boxes for each of the images in the dataset.

Idli dataset
Car dataset

Step 2 — Create projects and train the models

I then created two projects one for Idli and the other for detecting “Maruti Suzuki” with the training dataset, the documentation recommends using a separate dataset for testing or split the dataset for training and testing — https://docs.aws.amazon.com/rekognition/latest/customlabels-dg/tm-train-model.html

Wait for the training to be completed, it takes some time based on the dataset and labels. Amazon Rekognition Custom Labels simplifies this process by choosing the right algorithm for you.

Voila, start the model and test !!

Instead of writing an app to test the results, AWS has a simple app to test Custom Labels with models trained by Amazon Rekognition -https://github.com/aws-samples/amazon-rekognition-custom-labels-demo

I deployed this app, and then start the models and upload your images to test them.

Idli detection test results -

doughnut !!
Idli and accompaniments !!

Maruti Suzuki car detection test case -

“Maruti Suzuki” !!
Not an “Maruti Suzuki” !!

The Amazon Rekognition custom labels feature is awesome and great for use-cases to ACCURATELY MEASURE BRAND COVERAGE,DISCOVER CONTENT FOR SYNDICATION, IMPROVE OPERATIONAL EFFICIENCY and others — https://aws.amazon.com/rekognition/custom-labels-features/

Hope this blog was useful to get you off the couch and get started ;-)

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Mani
Mani

Written by Mani

Principal Solutions Architect at AWS India, and I blog/post about interesting stuff that I am curious about and which is relevant to developers & customers.

Responses (2)

Write a response

Hello Mani, great article. I've a question for you. Is there a provision to export the custom trained mobel?

--

Hi, good day and nice article, Please i just wanted to find out as opposed to doing everything on the console, is there a Javascript Implementation using SDK….Cause am searching their documentation and am only seeing Python, java and Cli Implemetations…Any help will be highly Appreciated Thanks…

--