Amazon Rekognition is an AWS service based on Deep Learning technology, with the ability to recognize faces, labels, objects, places, etc. from the analysis of images and videos.

The recognition service of Custom LabelsIt allows you to recognize images that correspond to your brand, or elements in a photograph that interest you.

To train an Amazon Rekognition model to identify labels, you will only need a dataset with images that contain the element you wish to recognize.

The larger the dataset, the more accurate will be the behavior of the model.

Process flow

Project preparation

To learn how to set up your project Amazon Rekognition To detect labels, follow the steps in the following video.

Once the model is trained, we can use it through API calls from our application.

JAVA IMPLEMENTATION

To call the API we need a Rekognition client:

To construct a request with the image we want to analyze, the project ARN, and the minimum match, for this example we use 90%

Finally, make the call and store it in a response.

Remember that for Machine Learning models, the answer is not deterministic true/false, it is probabilisticAn example of the answer is:

In this example, the API detected the tag zenta-square-black, with a match of 99.99500%The answer also indicates the location of the image and the size of the area it occupies in the original photograph.

With the original image size and this data, you can calculate where the label is and, via programming, draw the label.

If you take the image size and the coordinates from the response, you can calculate how to draw a rectangle on the image that indicates where AWS recognized the label.

A Java solution for draw the rectangles The image would look like this:

TEST EXECUTION

To test the model, 3 images with one of the Zenta logos were sent, and on all 3 occasions the implementation detected the brand, and drew a rectangle based on the coordinates returned by the answer.

A example of the system response, indicating the percentage of match, the name of the label and the position of the logo in the image.

AWS provides a easy-to-use service for training models capable of recognizing image fragments within other images. Additionally, an API that can be used from various programming languages ​​such as Java, Python, JavaScript, NodeJS, etc.

With this solution, it is possible to recognize your brand, logos, objects, products in a warehouse, etc. in an image, using the service of Amazon Rekognition, without the need to develop a custom model that can take a considerable amount of time and effort.

The source code is available here: GitHub