Programmable Media

Amazon Rekognition Auto Tagging

Last updated: Apr-18-2024

Cloudinary is a cloud-based service that provides an end-to-end asset management solution including uploads, storage, transformations, optimizations and delivery. Cloudinary offers a very rich set of image transformation and analysis capabilities and allows you to extract the semantic data from uploaded images: photo metadata (Exif & IPTC) including location and camera details, coordinates of automatically detected faces, color histogram and predominant colors. In addition, Cloudinary allows you to assign multiple tags to images for listing and managing your media assets.

Amazon Rekognition is a service that makes it easy to add image analysis to your applications. Cloudinary provides an add-on for Amazon Rekognition's automatic image tagging capabilities, fully integrated into Cloudinary's image management and transformation pipeline. Amazon Rekognition uses deep neural network models to automatically identify scenes and suggests tags, a process that would take huge amounts of time and resources if performed manually. Amazon Rekognition's deep learning-based image recognition allows you to search, verify and organize all your images and results in outstanding performance in terms of the time needed to process large photo volumes with a very high precision rate.

With the Amazon Rekognition Auto Tagging add-on, you can extend Cloudinary's powerful semantic data extraction and image tagging features. When using the Amazon Rekognition Auto Tagging add-on, your images are automatically tagged according to the categories detected in each image.

Tips
  • You can optionally request the category and tag results in another language or in multiple languages by registering for the Google Translation Add-on in addition to the tagging add-on.
  • This page describes how to use the Amazon Rekognition Auto Tagging add-on programmatically in Programmable Media, but that you can also use the add-on for DAM use-cases in Assets. For more information, see Amazon Rekognition Auto Tagging in the Assets user guide.

Getting started

Before you can use the Amazon Rekognition Auto Tagging add-on:

  • You must have a Cloudinary account. If you don't already have one, you can sign up for a free account.

  • Register for the add-on: make sure you're logged in to your account and then go to the Add-ons page. For more information about add-on registrations, see Registering for add-ons.

  • Keep in mind that many of the examples on this page use our SDKs. For SDK installation and configuration details, see the relevant SDK guide.

  • If you are new to Cloudinary, you may want to take a look at How to integrate Cloudinary in your app for a walk through on the basics of creating and setting up your account, working with SDKs, and then uploading, transforming and delivering assets.

Image recognition and categorization

Take a look at the following photo, depicting a guitarist on stage:

guitarist.jpg

By setting the categorization parameter to aws_rek_tagging when calling Cloudinary's upload or update methods, Amazon Rekognition is used to automatically classify the scenes of the uploaded or specified existing image. For example:

Tips
  • Images must have a minimum height and width of 80 pixels.
  • You can use upload presets to centrally define a set of upload options including add-on operations to apply, instead of specifying them in each upload call. You can define multiple upload presets, and apply different presets in different upload scenarios. You can create new upload presets in the Upload page of the Console Settings or using the upload_presets Admin API method. From the Upload page of the Console Settings, you can also select default upload presets to use for image, video, and raw API uploads (respectively) as well as default presets for image, video, and raw uploads performed via the Media Library UI.

    Learn more: Upload presets

  • You can run multiple categorization add-ons on the resource. The categorization parameter accepts a comma-separated list of all the Cloudinary categorization add-ons to run on the resource.

The upload API response includes the automatic categorization identified by the Amazon Rekognition Auto Tagging add-on. As can be seen in the response snippet below, various categories were automatically detected in the uploaded photo. The confidence score is a numerical value that represents the confidence level of the detected category, where 1.0 means 100% confidence.

Automatically adding tags to images

Automatically categorizing your images is a useful way to organize your Cloudinary media assets, and by also providing the auto_tagging parameter to an upload or update call, images are automatically assigned resource tags based on the Amazon Rekognition detected scene categories. The value of the auto_tagging parameter is the minimum confidence score of a detected category that should be automatically used as an assigned resource tag. Assigning these resource tags allows you to list and search images using Cloudinary's API and Media Explorer.

The following code example automatically tags an uploaded image with all detected categories that have a score higher than 0.7.

The response of the upload API call above returns the detected categories as well as the assigned tags. In this case, only the 'People', 'Person', 'Human', 'Electric Guitar', 'Guitar', and 'Musical Instrument' categories have a high enough score to be used as tags.

You can also use the update method of the Admin API to apply Amazon Rekognition to already uploaded images, based on their public IDs, and then automatically tag them according to the detected categories.

For example, the following image was uploaded to Cloudinary with the koala5 public ID.

koala5.jpg

The following code sample uses Cloudinary's update method to apply Amazon Rekognition's automatic image tagging and categorization to the koala5 uploaded image, and then automatically assign resource tags based on the categories detected with over a 90% confidence level.

The response of the update API call includes the detected categories, and automatically assigned tags. As you can see in the response snippet below, the 'Animal', 'Koala' and 'Mammal' scene categories were detected with a confidence score of over 90%, which led to them being auto-assigned as tags.

You can use the Admin API's resource method to return the details of a resource, including the scene categories that you already extracted using the upload or update methods.

✔️ Feedback sent!

Rate this page: