Improving Content Moderation with Amazon Rekognition Bulk Analysis and Custom Moderation
Amazon Rekognition makes it easy to add image and video analysis to your applications… It’s based on the same proven, highly scalable, deep learning technology developed by Amazon’s computer vision scientists to analyze billions of images and videos daily… Amazon Rekognition includes a simpl…
Amazon Rekognition makes it easy to add image and video analysis to your applications. It’s based on the same proven, highly scalable, deep learning technology developed by Amazon’s computer vision scientists to analyze billions of images and videos daily. It requires no machine learning (ML) expertise to use and we’re continually adding new computer vision features to the service. Amazon Rekognition includes a simple, easy-to-use API that can quickly analyze any image or video file that’s stored in Amazon Simple Storage Service (Amazon S3).
Customers across industries such as advertising and marketing technology, gaming, media, and retail & e-commerce rely on images uploaded by their end-users (user-generated content or UGC) as a critical component to drive engagement on their platform. They use Amazon Rekognition content moderation to detect inappropriate, unwanted, and offensive content in order to protect their brand reputation and foster safe user communities.
In this post, we will discuss the following:
- Content Moderation model version 7.0 and capabilities
- How does Amazon Rekognition Bulk Analysis work for Content Moderation
- How to improve Content Moderation prediction with Bulk Analysis and Custom Moderation
Content Moderation Model Version 7.0 and Capabilities
Amazon Rekognition Content Moderation version 7.0 adds 26 new moderation labels and expands the moderation label taxonomy from a two-tier to a three-tier label category. These new labels and the expanded taxonomy enable customers to detect fine-grained concepts on the content they want to moderate. Additionally, the updated model introduces a new capability to identify two new content types, animated and illustrated content. This allows customers to create granular rules for including or excluding such content types from their moderation workflow. With these new updates, customers can moderate content in accordance with their content policy with higher accuracy.
Let’s look at a moderation label detection example for the following image.
The following table shows the moderation labels, content type, and confidence scores returned in the API response.
Moderation Labels | Taxonomy Level | Confidence Scores |
Violence | L1 | 92.6% |
Graphic Violence | L2 | 92.6% |
Explosions and Blasts | L3 | 92.6% |
Content Types | Confidence Scores |
Illustrated | 93.9% |
To obtain the full taxonomy for Content Moderation version 7.0, visit our developer guide.
Bulk Analysis for Content Moderation
Amazon Rekognition Content Moderation also provides batch image moderation in addition to real-time moderation using Amazon Rekognition Bulk Analysis. It enables you to analyze large image collections asynchronously to detect inappropriate content and gain insights into the moderation categories assigned to the images. It also eliminates the need for building a batch image moderation solution for customers.
You can access the bulk analysis feature either via the Amazon Rekognition console or by calling the APIs directly using the AWS CLI and the AWS SDKs. On the Amazon Rekognition console, you can upload the images you want to analyze and get results with a few clicks. Once the bulk analysis job completes, you can identify and view the moderation label predictions, such as Explicit, Non-Explicit Nudity of Intimate parts and Kissing, Violence, Drugs & Tobacco, and more. You also receive a confidence score for each label category.
Create a bulk analysis job on the Amazon Rekognition console
Complete the following steps to try Amazon Rekognition Bulk Analysis:
- On the Amazon Rekognition console, choose Bulk Analysis in the navigation pane.
- Choose Start Bulk Analysis.
- Enter a job name and specify the images to analyze, either by entering an S3 bucket location or by uploading images from your computer.
- Optionally, you can select an adapter to analyze images using the custom adapter that you have trained using Custom Moderation.
- Choose Start analysis to run the job.
When the process is complete, you can see the results on the Amazon Rekognition console. Also, a JSON copy of the analysis results will be stored in the Amazon S3 output location.
Amazon Rekognition Bulk Analysis API request
In this section, we guide you through creating a bulk analysis job for image moderation using programming interfaces. If your image files aren’t already in an S3 bucket, upload them to ensure access by Amazon Rekognition. Similar to creating a bulk analysis job on the Amazon Rekognition console, when invoking the StartMediaAnalysisJob API, you need to provide the following parameters:
- OperationsConfig – These are the configuration options for the media analysis job to be created:
- MinConfidence – The minimum confidence level with the valid range of 0–100 for the moderation labels to return. Amazon Rekognition doesn’t return any labels with a confidence level lower than this specified value.
- Input – This includes the following:
- S3Object – The S3 object information for the input manifest file, including the bucket and name of the file. input file includes JSON lines for each image stored on S3 bucket. for example:
{"source-ref": "s3://MY-INPUT-BUCKET/1.jpg"}
- S3Object – The S3 object information for the input manifest file, including the bucket and name of the file. input file includes JSON lines for each image stored on S3 bucket. for example:
- OutputConfig – This includes the following:
- S3Bucket – The S3 bucket name for the output files.
- S3KeyPrefix – The key prefix for the output files.
See the following code:
You can invoke the same media analysis using the following AWS CLI command:
Amazon Rekognition Bulk Analysis API results
To get a list of bulk analysis jobs, you can use ListMediaAnalysisJobs
. The response includes all the details about the analysis job input and output files and the status of the job:
You can also invoke the list-media-analysis-jobs
command via the AWS CLI:
Amazon Rekognition Bulk Analysis generates two output files in the output bucket. The first file is manifest-summary.json
, which includes bulk analysis job statistics and a list of errors:
The second file is results.json
, which includes one JSON line per each analyzed image in the following format. Each result includes the top-level category (L1) of a detected label and the second-level category of the label (L2), with a confidence score between 1–100. Some Taxonomy Level 2 labels may have Taxonomy Level 3 labels (L3). This allows a hierarchical classification of the content.
You can use Custom Moderation adapters later to analyze your images by simply selecting the custom adapter while creating a new bulk analysis job or via API by passing the custom adapter’s unique adapter ID.
Summary
In this post, we provided an overview of Content Moderation version 7.0, Bulk Analysis for Content Moderation, and how to improve Content Moderation predictions using Bulk Analysis and Custom Moderation. To try the new moderation labels and bulk analysis, log in to your AWS account and check out the Amazon Rekognition console for Image Moderation and Bulk Analysis.
About the authors
Mehdy Haghy is a Senior Solutions Architect at AWS WWCS team, specializing in AI and ML on AWS. He works with enterprise customers, helping them migrate, modernize, and optimize their workloads for the AWS cloud. In his spare time, he enjoys cooking Persian foods and electronics tinkering.
Shipra Kanoria is a Principal Product Manager at AWS. She is passionate about helping customers solve their most complex problems with the power of machine learning and artificial intelligence. Before joining AWS, Shipra spent over 4 years at Amazon Alexa, where she launched many productivity-related features on the Alexa voice assistant.
Maria Handoko is a Senior Product Manager at AWS. She focuses on helping customers solve their business challenges through machine learning and computer vision. In her spare time, she enjoys hiking, listening to podcasts, and exploring different cuisines.
Author: Mehdy Haghy