Taking advantage of AWS Rekognition with Elixir (ex_aws_rekognition 📦)
When attending AWS Summit Madrid 2019 (#AWSSummit) we had the chance to watch the keynotes and speak with multiple companies that are exploring the vast majority of the Amazon solutions. Most of them justified their choice of using Amazon Web Services (AWS) with three main reasons:
- Offering — a lot of services, where most are easy to integrate with their systems
- Low-cost —when compared to supporting a team to create your own solutions
- Partnership — their engineers are always ready to help your company decide what's best and to provide technical help
As you may know, AWS is continuously expanding its value offering to all the different companies it serves. It currently offers more than 150 products from which 19 are in Machine Learning, making it the area with the most solutions available.
Rekognition is a ready-to-use Machine Learning product capable of doing real-time video and image analysis such as detect text, detect faces and extract labels.
This article intent is to emphasise the potential of AWS Rekognition displaying its value with some examples and sample code using an existent package we developed to easily integrate all of its functionalities into your Elixir project.
Elixir Package (ex_aws_rekognition 📦)
We are integrating some of the Rekognition functionalities with our projects and, since we were not able to find any Elixir package available, we decided to contribute to the community by building a package that wraps the service.
Building the entire AWS authentication and request handling would greatly increase the effort to implement the package and we didn’t want to reinvent the wheel given that ex_aws already had everything we needed, we were only missing the specific Rekognition actions implementation.
We find really important to contribute to the open source community, specially in a language like Elixir where we found the people to be open and willing to share.
In the end, we got our Rekognition package that fully supports all features available at the moment.
Any contributions are welcomed and greatly appreciated!! 😃
Facial Analysis (Landmarks, Emotions, Gender and Age Range)
Using the available DetectFaces action, you are able to search a given image for faces and their corresponding characteristics and attributes.
The response is given in real time and we are able to retrieve more concrete characteristics like the facial landmarks (eyes, mouth, nose, etc…) and some deductions like the gender, age range and even the emotions the face may be expressing.
Rekognition deduced the person in the picture to be a female between the age of 20 and 38, expressing happiness. Take a look at the response below to see the entire attributes you receive.
Detect Text (Optical Character Recognition — OCR)
There are many use cases one can give to an OCR. One can take advantage of this service by using it to retrieve cards information without the need to type it and it can also be used to identify car plates with decent accuracy.
Using the available DetectText action, you are able to retrieve all the locations and pieces of text found within the given image, all this in real time.
In the response, you get the list of detections that occurred. Each detection contains a confidence value, a string with the detected text and also the geometry values that help you locate the text within the image.
This functionality is more suited for pictures with less text and doesn’t cope well with a full document analysis use case. AWS is currently working on a different product, Textract, which they intend it to be used to digitalise paper documents and easily access the information inside them providing means of indexing and searching.
Index, List and Identify Faces in Images
Imagine you have a system or an application that requires you to identify the users by the face and you happen to have a picture of the person, Rekognition is able to do this almost without any setup necessary on your hand.
Rekognition contains a set of actions that allow you to create collections of faces and these handle the data storage for the faces, meaning you don’t need to store this on your backend.
The documentation clearly states that no face is being saved, only the feature vectors for each face are stored and that is enough for the algorithm to recognise faces in other images.
In order to do such a feature we need to take advantage of multiple actions following the order:
There are many different use cases for this product and the best way to see how the other companies are taking advantage of Rekognition and the remainder AWS products is to attend the Amazon Summits that are being held all around the 🌍.
As a final note, if you intend to integrate a specific AWS product but it is still not supported by the ex_aws organisation, make sure you contact us and we can create it together! 😃
Thank you for reading!
Thank you so much for reading and if you enjoyed this article make sure to hit that 👏👏 button. It means a lot to us! Also don’t forget to follow Coletiv on Medium, Twitter, and LinkedIn as we keep posting more and more interesting articles on multiple technologies.
In case you don’t know, Coletiv is a software development studio from Porto specialised in Elixir, iOS, and Android app development. But we do all kinds of stuff. We take care of UX/UI design, web development, and even security for you.