Hawk-Rust Series: AWS Lambda for image recognition

This blog is about the heart of the Hawk which is the image recognition process. For this, we used Amazon Rekognition service. Don’t worry I will come to all these terminologies step by step. But I advise you to first go through the first blog post of Hawk-Rust series which will help you to understand the overall architecture of the Hawk. You can refer it from here: Hawk.

Prerequisite

Here we go.
To use AWS Rekognition there are few prerequisites like having an AWS account and IAM user credentials with proper roles assigned to it.

We used Rust as a programming language for Hawk and AWS Rekognition image comparison API. Amazon’s Rekognition, a facial recognition cloud service for developers it took two images and returns you the confidence score which is a kind of similarity score of two faces. Let’s take an example where we want to compare an image with an image of a group of people, the compare face API will give you a list of confidence score in decreasing order i.e. more the face is similar to source image the greater will be the score.

Image result for aws lambda

And to use this service we need another AWS service which is AWS Lambda. AWS Lambda is a compute service that lets you run code without managing servers i.e. it scales automatically when needed. Here you can simply write code to use AWS Recognition.

Triggering the Compare face API


Currently, AWS Lambda supports Java, Go, PowerShell, Node.js, C#, Python, and Ruby code only. And we used Java, we write code to make a jar and upload it there on AWS Lambda. Now we created a handler how can we invoke it.
AWS Lambda gives you a list of triggers like AWS API, S3, Dynamo DB and many more. This makes our service even driven and therefore cost-effective. Since we are not running our service 24×7. We used API service to trigger the event, it created endpoints which is used by our Hawk Rust application to send request and with clicked image of the person from the camera and same API gateway is being used to get the response and the confidential score.

Conclusion

Congratulations folks! we have come this far. Hope you guys like my blog and share you views in the comment section.
For more reference and contributing to our open source project Hawk, you can visit here.


knoldus-advt-sticker

Written by 

Alok Jha is the Trainee Software Consultant at Knoldus Software LLP. He has good knowledge of languages C, C++, Java and currently exploring Rust. As a fresher, he always tries to explore the different type of software and tools.

Leave a Reply

Knoldus Pune Careers - Hiring Freshers

Get a head start on your career at Knoldus. Join us!