DetectModerationLabels - Amazon Rekognition


Detects unsafe content in a specified JPEG or PNG format image. Use DetectModerationLabels to moderate images depending on your requirements. For example, you might want to filter images that contain nudity, but not images containing suggestive content.

To filter images, use the labels returned by DetectModerationLabels to determine which types of content are appropriate.

For information about moderation labels, see Content moderation.

You pass the input image either as base64-encoded image bytes or as a reference to an image in an Amazon S3 bucket. If you use the AWS CLI to call Amazon Rekognition operations, passing image bytes is not supported. The image must be either a PNG or JPEG formatted file.

Request Syntax

{ "HumanLoopConfig": { "DataAttributes": { "ContentClassifiers": [ "string" ] }, "FlowDefinitionArn": "string", "HumanLoopName": "string" }, "Image": { "Bytes": blob, "S3Object": { "Bucket": "string", "Name": "string", "Version": "string" } }, "MinConfidence": number }

Request Parameters

The request accepts the following data in JSON format.


Sets up the configuration for human evaluation, including the FlowDefinition the image will be sent to.

Type: HumanLoopConfig object

Required: No


The input image as base64-encoded bytes or an S3 object. If you use the AWS CLI to call Amazon Rekognition operations, passing base64-encoded image bytes is not supported.

If you are using an AWS SDK to call Amazon Rekognition, you might not need to base64-encode image bytes passed using the Bytes field. For more information, see Images.

Type: Image object

Required: Yes


Specifies the minimum confidence level for the labels to return. Amazon Rekognition doesn't return any labels with a confidence level lower than this specified value.

If you don't specify MinConfidence, the operation returns labels with confidence values greater than or equal to 50 percent.

Type: Float

Valid Range: Minimum value of 0. Maximum value of 100.

Required: No

Response Syntax

{ "HumanLoopActivationOutput": { "HumanLoopActivationConditionsEvaluationResults": "string", "HumanLoopActivationReasons": [ "string" ], "HumanLoopArn": "string" }, "ModerationLabels": [ { "Confidence": number, "Name": "string", "ParentName": "string" } ], "ModerationModelVersion": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.


Shows the results of the human in the loop evaluation.

Type: HumanLoopActivationOutput object


Array of detected Moderation labels and the time, in milliseconds from the start of the video, they were detected.

Type: Array of ModerationLabel objects


Version number of the moderation detection model that was used to detect unsafe content.

Type: String



You are not authorized to perform the action.

HTTP Status Code: 400


The number of in-progress human reviews you have has exceeded the number allowed.

HTTP Status Code: 400


The input image size exceeds the allowed limit. If you are calling DetectProtectiveEquipment, the image size or resolution exceeds the allowed limit. For more information, see Guidelines and quotas in Amazon Rekognition.

HTTP Status Code: 400


Amazon Rekognition experienced a service issue. Try your call again.

HTTP Status Code: 500


The provided image format is not supported.

HTTP Status Code: 400


Input parameter violated a constraint. Validate your parameter before calling the API operation again.

HTTP Status Code: 400


Amazon Rekognition is unable to access the S3 object specified in the request.

HTTP Status Code: 400


The number of requests exceeded your throughput limit. If you want to increase this limit, contact Amazon Rekognition.

HTTP Status Code: 400


Amazon Rekognition is temporarily unable to process the request. Try your call again.

HTTP Status Code: 500

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: