Amazon Rekognition

2017/04/19 - Amazon Rekognition - 1 new api methods

Changes  Given an image, the API detects explicit or suggestive adult content in the image and returns a list of corresponding labels with confidence scores, as well as a taxonomy (parent-child relation) for each label.

DetectModerationLabels (new) Link ΒΆ

Detects explicit or suggestive adult content in a specified .jpeg or .png 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 howitworks-moderateimage.

See also: AWS API Documentation

Request Syntax

client.detect_moderation_labels(
    Image={
        'Bytes': b'bytes',
        'S3Object': {
            'Bucket': 'string',
            'Name': 'string',
            'Version': 'string'
        }
    },
    MinConfidence=...
)
type Image

dict

param Image

[REQUIRED]

Provides the source image either as bytes or an S3 object.

The region for the S3 bucket containing the S3 object must match the region you use for Amazon Rekognition operations.

You may need to Base64-encode the image bytes depending on the language you are using and whether or not you are using the AWS SDK. For more information, see example4.

If you use the Amazon CLI to call Amazon Rekognition operations, passing image bytes using the Bytes property is not supported. You must first upload the image to an Amazon S3 bucket and then call the operation using the S3Object property.

For Amazon Rekognition to process an S3 object, the user must have permission to access the S3 object. For more information, see manage-access-resource-policies.

  • Bytes (bytes) --

    Blob of image bytes up to 5 MBs.

  • S3Object (dict) --

    Identifies an S3 object as the image source.

    • Bucket (string) --

      Name of the S3 bucket.

    • Name (string) --

      S3 object key name.

    • Version (string) --

      If the bucket is versioning enabled, you can specify the object version.

type MinConfidence

float

param MinConfidence

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.

rtype

dict

returns

Response Syntax

{
    'ModerationLabels': [
        {
            'Confidence': ...,
            'Name': 'string',
            'ParentName': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • ModerationLabels (list) --

      A list of labels for explicit or suggestive adult content found in the image. The list includes the top-level label and each child label detected in the image. This is useful for filtering specific categories of content.

      • (dict) --

        Provides information about a single type of moderated content found in an image. Each type of moderated content has a label within a hierarchical taxonomy. For more information, see howitworks-moderateimage.

        • Confidence (float) --

          Specifies the confidence that Amazon Rekognition has that the label has been correctly identified.

          If you don't specify the MinConfidence parameter in the call to DetectModerationLabels , the operation returns labels with a confidence value greater than or equal to 50 percent.

        • Name (string) --

          The label name for the type of content detected in the image.

        • ParentName (string) --

          The name for the parent label. Labels at the top-level of the hierarchy have the parent label "" .