Menu
Amazon Rekognition
Developer Guide

Moderating Images

To determine if an image contains explicit or suggestive adult content, Amazon Rekognition provides the DetectModerationLabels API operation.

Amazon Rekognition uses a hierarchical taxonomy to label categories of explicit and suggestive content. The two top-level categories are Explicit Nudity, and Suggestive. Each top-level category has a number of second-level categories.

Top-Level Category Second-Level Category

Explicit Nudity

Nudity

Graphic Male Nudity

Graphic Female Nudity

Sexual Activity

Partial Nudity

Suggestive

Female Swimwear Or Underwear

Male Swimwear Or Underwear

Revealing Clothes

You determine the suitability of an image for your application. For example, images of a suggestive nature might be acceptable, but images containing nudity might not. To filter images, use the ModerationLabel labels array returned by DetectModerationLabels.

The ModerationLabel array contains labels in the preceding categories and an estimated confidence in the accuracy of the recognized content. A top-level label is returned along with any second-level labels that were identified. For example, Rekognition may return “Explicit Nudity” with a high confidence score as a top-level label. That may be enough for your filtering needs, but if necessary, you can use the confidence score of a second-level label, such as "Partial Nudity", to obtain more granular filtering. For an example, see Detecting Moderation Labels.

Note

Rekognition Image Moderation API is not an authority on, or in any way purports to be an exhaustive filter of, explicit and suggestive adult content. Furthermore, the Image Moderation API does not detect whether an image includes illegal content (such as child pornography) or unnatural adult content.

DetectModerationLabels can retrieve input images from an S3 bucket or you can provide them as image bytes.

The following example is the response from a call to DetectModerationLabels.

Copy
{ "ModerationLabels": [ { "Confidence": 99.24723052978516, "ParentName": "", "Name": "Explicit Nudity" }, { "Confidence": 99.24723052978516, "ParentName": "Explicit Nudity", "Name": "Graphic Male Nudity" }, { "Confidence": 88.25341796875, "ParentName": "Explicit Nudity", "Name": "Sexual Activity" } ] }

The response includes the following:

  • Image moderation information – The example shows a list of moderation labels for explicit or suggestive content found in the image. The list includes the top-level label and each second-level label detected in the image.

    Label – Each label has a name, an estimation of the confidence that Amazon Rekognition has that the label is accurate, and the name of its parent label. The parent name for a top-level label is "".

    Label confidence – Each label has a confidence value between 0 and 100 that indicates the percentage confidence that Amazon Rekognition has that the label is correct. You specify the required confidence level for a label to be returned in the response in the API operation request.