Amazon Rekognition

2021/03/25 - Amazon Rekognition - 3 new 3 updated api methods

Changes  "This release introduces AWS tagging support for Amazon Rekognition collections, stream processors, and Custom Label models."

UntagResource (new) Link ¶

Removes one or more tags from an Amazon Rekognition collection, stream processor, or Custom Labels model.

See also: AWS API Documentation

Request Syntax

client.untag_resource(
    ResourceArn='string',
    TagKeys=[
        'string',
    ]
)
type ResourceArn

string

param ResourceArn

[REQUIRED]

Amazon Resource Name (ARN) of the model, collection, or stream processor that you want to remove the tags from.

type TagKeys

list

param TagKeys

[REQUIRED]

A list of the tags that you want to remove.

  • (string) --

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

ListTagsForResource (new) Link ¶

Returns a list of tags in an Amazon Rekognition collection, stream processor, or Custom Labels model.

See also: AWS API Documentation

Request Syntax

client.list_tags_for_resource(
    ResourceArn='string'
)
type ResourceArn

string

param ResourceArn

[REQUIRED]

Amazon Resource Name (ARN) of the model, collection, or stream processor that contains the tags that you want a list of.

rtype

dict

returns

Response Syntax

{
    'Tags': {
        'string': 'string'
    }
}

Response Structure

  • (dict) --

    • Tags (dict) --

      A list of key-value tags assigned to the resource.

      • (string) --

        • (string) --

TagResource (new) Link ¶

Adds one or more key-value tags to an Amazon Rekognition collection, stream processor, or Custom Labels model. For more information, see Tagging AWS Resources .

See also: AWS API Documentation

Request Syntax

client.tag_resource(
    ResourceArn='string',
    Tags={
        'string': 'string'
    }
)
type ResourceArn

string

param ResourceArn

[REQUIRED]

Amazon Resource Name (ARN) of the model, collection, or stream processor that you want to assign the tags to.

type Tags

dict

param Tags

[REQUIRED]

The key-value tags to assign to the resource.

  • (string) --

    • (string) --

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

CreateCollection (updated) Link ¶
Changes (request)
{'Tags': {'string': 'string'}}

Creates a collection in an AWS Region. You can add faces to the collection using the IndexFaces operation.

For example, you might create collections, one for each of your application users. A user can then index faces using the IndexFaces operation and persist results in a specific collection. Then, a user can search the collection for faces in the user-specific container.

When you create a collection, it is associated with the latest version of the face model version.

Note

Collection names are case-sensitive.

This operation requires permissions to perform the rekognition:CreateCollection action.

See also: AWS API Documentation

Request Syntax

client.create_collection(
    CollectionId='string',
    Tags={
        'string': 'string'
    }
)
type CollectionId

string

param CollectionId

[REQUIRED]

ID for the collection that you are creating.

type Tags

dict

param Tags

A set of tags (key-value pairs) that you want to attach to the collection.

  • (string) --

    • (string) --

rtype

dict

returns

Response Syntax

{
    'StatusCode': 123,
    'CollectionArn': 'string',
    'FaceModelVersion': 'string'
}

Response Structure

  • (dict) --

    • StatusCode (integer) --

      HTTP status code indicating the result of the operation.

    • CollectionArn (string) --

      Amazon Resource Name (ARN) of the collection. You can use this to manage permissions on your resources.

    • FaceModelVersion (string) --

      Version number of the face detection model associated with the collection you are creating.

CreateProjectVersion (updated) Link ¶
Changes (request)
{'Tags': {'string': 'string'}}

Creates a new version of a model and begins training. Models are managed as part of an Amazon Rekognition Custom Labels project. You can specify one training dataset and one testing dataset. The response from CreateProjectVersion is an Amazon Resource Name (ARN) for the version of the model.

Training takes a while to complete. You can get the current status by calling DescribeProjectVersions .

Once training has successfully completed, call DescribeProjectVersions to get the training results and evaluate the model.

After evaluating the model, you start the model by calling StartProjectVersion .

This operation requires permissions to perform the rekognition:CreateProjectVersion action.

See also: AWS API Documentation

Request Syntax

client.create_project_version(
    ProjectArn='string',
    VersionName='string',
    OutputConfig={
        'S3Bucket': 'string',
        'S3KeyPrefix': 'string'
    },
    TrainingData={
        'Assets': [
            {
                'GroundTruthManifest': {
                    'S3Object': {
                        'Bucket': 'string',
                        'Name': 'string',
                        'Version': 'string'
                    }
                }
            },
        ]
    },
    TestingData={
        'Assets': [
            {
                'GroundTruthManifest': {
                    'S3Object': {
                        'Bucket': 'string',
                        'Name': 'string',
                        'Version': 'string'
                    }
                }
            },
        ],
        'AutoCreate': True|False
    },
    Tags={
        'string': 'string'
    }
)
type ProjectArn

string

param ProjectArn

[REQUIRED]

The ARN of the Amazon Rekognition Custom Labels project that manages the model that you want to train.

type VersionName

string

param VersionName

[REQUIRED]

A name for the version of the model. This value must be unique.

type OutputConfig

dict

param OutputConfig

[REQUIRED]

The Amazon S3 location to store the results of training.

  • S3Bucket (string) --

    The S3 bucket where training output is placed.

  • S3KeyPrefix (string) --

    The prefix applied to the training output files.

type TrainingData

dict

param TrainingData

[REQUIRED]

The dataset to use for training.

  • Assets (list) --

    A Sagemaker GroundTruth manifest file that contains the training images (assets).

    • (dict) --

      Assets are the images that you use to train and evaluate a model version. Assets can also contain validation information that you use to debug a failed model training.

      • GroundTruthManifest (dict) --

        The S3 bucket that contains an Amazon Sagemaker Ground Truth format manifest file.

        • S3Object (dict) --

          Provides the S3 bucket name and object name.

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

          For Amazon Rekognition to process an S3 object, the user must have permission to access the S3 object. For more information, see Resource-Based Policies in the Amazon Rekognition Developer Guide.

          • 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 TestingData

dict

param TestingData

[REQUIRED]

The dataset to use for testing.

  • Assets (list) --

    The assets used for testing.

    • (dict) --

      Assets are the images that you use to train and evaluate a model version. Assets can also contain validation information that you use to debug a failed model training.

      • GroundTruthManifest (dict) --

        The S3 bucket that contains an Amazon Sagemaker Ground Truth format manifest file.

        • S3Object (dict) --

          Provides the S3 bucket name and object name.

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

          For Amazon Rekognition to process an S3 object, the user must have permission to access the S3 object. For more information, see Resource-Based Policies in the Amazon Rekognition Developer Guide.

          • 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.

  • AutoCreate (boolean) --

    If specified, Amazon Rekognition Custom Labels creates a testing dataset with an 80/20 split of the training dataset.

type Tags

dict

param Tags

A set of tags (key-value pairs) that you want to attach to the model.

  • (string) --

    • (string) --

rtype

dict

returns

Response Syntax

{
    'ProjectVersionArn': 'string'
}

Response Structure

  • (dict) --

    • ProjectVersionArn (string) --

      The ARN of the model version that was created. Use DescribeProjectVersion to get the current status of the training operation.

CreateStreamProcessor (updated) Link ¶
Changes (request)
{'Tags': {'string': 'string'}}

Creates an Amazon Rekognition stream processor that you can use to detect and recognize faces in a streaming video.

Amazon Rekognition Video is a consumer of live video from Amazon Kinesis Video Streams. Amazon Rekognition Video sends analysis results to Amazon Kinesis Data Streams.

You provide as input a Kinesis video stream (Input ) and a Kinesis data stream (Output ) stream. You also specify the face recognition criteria in Settings . For example, the collection containing faces that you want to recognize. Use Name to assign an identifier for the stream processor. You use Name to manage the stream processor. For example, you can start processing the source video by calling StartStreamProcessor with the Name field.

After you have finished analyzing a streaming video, use StopStreamProcessor to stop processing. You can delete the stream processor by calling DeleteStreamProcessor .

See also: AWS API Documentation

Request Syntax

client.create_stream_processor(
    Input={
        'KinesisVideoStream': {
            'Arn': 'string'
        }
    },
    Output={
        'KinesisDataStream': {
            'Arn': 'string'
        }
    },
    Name='string',
    Settings={
        'FaceSearch': {
            'CollectionId': 'string',
            'FaceMatchThreshold': ...
        }
    },
    RoleArn='string',
    Tags={
        'string': 'string'
    }
)
type Input

dict

param Input

[REQUIRED]

Kinesis video stream stream that provides the source streaming video. If you are using the AWS CLI, the parameter name is StreamProcessorInput .

  • KinesisVideoStream (dict) --

    The Kinesis video stream input stream for the source streaming video.

    • Arn (string) --

      ARN of the Kinesis video stream stream that streams the source video.

type Output

dict

param Output

[REQUIRED]

Kinesis data stream stream to which Amazon Rekognition Video puts the analysis results. If you are using the AWS CLI, the parameter name is StreamProcessorOutput .

  • KinesisDataStream (dict) --

    The Amazon Kinesis Data Streams stream to which the Amazon Rekognition stream processor streams the analysis results.

    • Arn (string) --

      ARN of the output Amazon Kinesis Data Streams stream.

type Name

string

param Name

[REQUIRED]

An identifier you assign to the stream processor. You can use Name to manage the stream processor. For example, you can get the current status of the stream processor by calling DescribeStreamProcessor . Name is idempotent.

type Settings

dict

param Settings

[REQUIRED]

Face recognition input parameters to be used by the stream processor. Includes the collection to use for face recognition and the face attributes to detect.

  • FaceSearch (dict) --

    Face search settings to use on a streaming video.

    • CollectionId (string) --

      The ID of a collection that contains faces that you want to search for.

    • FaceMatchThreshold (float) --

      Minimum face match confidence score that must be met to return a result for a recognized face. Default is 80. 0 is the lowest confidence. 100 is the highest confidence.

type RoleArn

string

param RoleArn

[REQUIRED]

ARN of the IAM role that allows access to the stream processor.

type Tags

dict

param Tags

A set of tags (key-value pairs) that you want to attach to the stream processor.

  • (string) --

    • (string) --

rtype

dict

returns

Response Syntax

{
    'StreamProcessorArn': 'string'
}

Response Structure

  • (dict) --

    • StreamProcessorArn (string) --

      ARN for the newly create stream processor.