Last updated: Jul-11-2023
Cloudinary is a cloud-based service that provides an end-to-end media asset management solution including uploads, storage, transformations, optimizations and delivery. Cloudinary offers a very rich set of transformation and analysis capabilities, and allows you to upload images and videos to the cloud, transform them on the fly and deliver them to your users optimized and cached via a fast CDN.
Amazon Rekognition is a service that makes it easy to add video analysis to your applications. Cloudinary provides an add-on for Amazon Rekognition's video moderation service based on deep learning algorithms, fully integrated into Cloudinary's video management and transformation pipeline.
With Amazon Rekognition's AI Moderation add-on, you can extend Cloudinary's powerful cloud-based transformation and delivery capabilities with automatic artificial intelligence based moderation of your videos. Protect your users from explicit and suggestive adult content in your user uploaded videos, making sure that no offensive videos are displayed to your web and mobile viewers.
Before you can use the Amazon Rekognition Video Moderation add-on:
You must have a Cloudinary account. If you don't already have one, you can sign up for a free account.
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.
The following list describes the flow of uploading and displaying moderated videos using Cloudinary and the Amazon Rekognition's AI Moderation add-on:
- Your users upload a video to Cloudinary through your application.
- The uploaded video is sent to Amazon Rekognition for moderation and set to a 'pending' status.
- The video is either approved or rejected by Amazon Rekognition.
- An optional notification callback is sent to your application with the video moderation result.
- A rejected video does not appear in your media library, but is backed up, consuming storage, so that it can be restored if necessary.
- Moderated videos can be listed programmatically using Cloudinary's Admin API or interactively using our online Media Library Web interface.
- You can manually override the automatic moderation using the Admin API or the Media Library.
Amazon Rekognition assigns a moderation confidence score (0 - 100) indicating the chances that a video belongs to an offensive content category.
There are two levels of categories for labelling unsafe content, with each top-level category containing a number of second-level categories, for example under the 'Violence' (
violence) category you have the sub-category 'Physical Violence' (
physical_violence). A full list of all the latest available categories and sub-categories is provided by AWS, see Amazon Rekognition categories.
The top level categories include:
- Explicit Nudity (
- Suggestive (
- Violence (
- Visually Disturbing (
- Rude Gestures (
- Drugs (
- Tobacco (
- Alcohol (
- Gambling (
- Hate Symbols (
The default moderation confidence level to reject a video is 0.5 for all categories, unless specifically overridden (see explanation and examples below). All videos classified by Amazon Rekognition with a value greater than the moderation confidence level (in any of the categories) are classified as 'rejected', otherwise their status is set to 'approved'.
To request moderation while uploading a video, with default moderation confidence levels, set the
moderation upload API parameter to
Learn more: Upload presets
You can also optionally:
- Override the default moderation confidence level (0.5) on a per category basis by including the category name and new value as part of the
moderationparameter value. You can override multiple categories, separated by colons.
NoteOverriding the default moderation confidence value of a top-level category will also set all its child categories to the same value, unless you specifically override one of the child categories as well.
- Exclude a category from the moderation check by setting the category's value to
- Return the
moderation_labelsarray, even if no offending content is found by setting:
- Set the Female Swimwear or Underwear child category to a minimum confidence level of 0.85
- Set the Explicit Nudity top-level category to 0.7. This then becomes the confidence level for all its child categories as well.
- Exclude the Revealing Clothes category from the check.
- Check all other categories at the default 0.5 confidence level.
- Confidence levels must be provided as a decimal number between 0.0 and 1.0.
- Videos must have a minimum height and width of 80 pixels.
As moderation is processed asynchronously, the initial upload response will include a
moderation parameter indicating the status and kind of moderation:
Once the moderation is complete, you will receive a notification indicating the results of the request for moderation. The snippet below shows that the moderation result has put the video in 'rejected' status.
moderation_labelsare returned in the response but all of them are taken into account for moderation.
Cloudinary's Admin API can be used to list all moderated videos. You can list either the approved or the rejected videos by specifying the second parameter of the
resources_by_moderation API method. For example to list all rejected videos:
As the automatic video moderation of the Amazon Rekognition AI Moderation add-on is based on a decision made by an advanced algorithm, in some cases you may want to manually override the moderation decision and either approve a previously rejected video or reject an approved one.
One way to manually override the moderation result is using Cloudinary's Media Library Web interface. From the left navigation menu, select Moderation. Then, from moderation tools list in the top menu, select Rekognition and then select the status (Rejected, or Approved) of the videos you want to display.
- When displaying the videos rejected by Amazon Rekognition, you can click on the green Approve button to revert the decision and recover the original rejected video.
- When displaying the videos approved by Amazon Rekognition, you can click on the red Reject button to revert the decision and prevent a certain video from being publicly available to your users.
Alternatively to using the Media Library interface, you can use Cloudinary's Admin API to manually override the moderation result. The following example uses the
update API method while specifying a public ID of a moderated video and setting the
moderation_status parameter to the