Amazon Rekognition

2022/04/27 - Amazon Rekognition - 1 new 6 updated api methods

Changes  This release adds support to configure stream-processor resources for label detections on streaming-videos. UpateStreamProcessor API is also launched with this release, which could be used to update an existing stream-processor.

UpdateStreamProcessor (new) Link ¶

Allows you to update a stream processor. You can change some settings and regions of interest and delete certain parameters.

See also: AWS API Documentation

Request Syntax

client.update_stream_processor(
    Name='string',
    SettingsForUpdate={
        'ConnectedHomeForUpdate': {
            'Labels': [
                'string',
            ],
            'MinConfidence': ...
        }
    },
    RegionsOfInterestForUpdate=[
        {
            'BoundingBox': {
                'Width': ...,
                'Height': ...,
                'Left': ...,
                'Top': ...
            },
            'Polygon': [
                {
                    'X': ...,
                    'Y': ...
                },
            ]
        },
    ],
    DataSharingPreferenceForUpdate={
        'OptIn': True|False
    },
    ParametersToDelete=[
        'ConnectedHomeMinConfidence'|'RegionsOfInterest',
    ]
)
type Name

string

param Name

[REQUIRED]

Name of the stream processor that you want to update.

type SettingsForUpdate

dict

param SettingsForUpdate

The stream processor settings that you want to update. Label detection settings can be updated to detect different labels with a different minimum confidence.

  • ConnectedHomeForUpdate (dict) --

    The label detection settings you want to use for your stream processor.

    • Labels (list) --

      Specifies what you want to detect in the video, such as people, packages, or pets. The current valid labels you can include in this list are: "PERSON", "PET", "PACKAGE", and "ALL".

      • (string) --

    • MinConfidence (float) --

      The minimum confidence required to label an object in the video.

type RegionsOfInterestForUpdate

list

param RegionsOfInterestForUpdate

Specifies locations in the frames where Amazon Rekognition checks for objects or people. This is an optional parameter for label detection stream processors.

  • (dict) --

    Specifies a location within the frame that Rekognition checks for objects of interest such as text, labels, or faces. It uses a BoundingBox or object or Polygon to set a region of the screen.

    A word, face, or label is included in the region if it is more than half in that region. If there is more than one region, the word, face, or label is compared with all regions of the screen. Any object of interest that is more than half in a region is kept in the results.

    • BoundingBox (dict) --

      The box representing a region of interest on screen.

      • Width (float) --

        Width of the bounding box as a ratio of the overall image width.

      • Height (float) --

        Height of the bounding box as a ratio of the overall image height.

      • Left (float) --

        Left coordinate of the bounding box as a ratio of overall image width.

      • Top (float) --

        Top coordinate of the bounding box as a ratio of overall image height.

    • Polygon (list) --

      Specifies a shape made up of up to 10 Point objects to define a region of interest.

      • (dict) --

        The X and Y coordinates of a point on an image or video frame. The X and Y values are ratios of the overall image size or video resolution. For example, if an input image is 700x200 and the values are X=0.5 and Y=0.25, then the point is at the (350,50) pixel coordinate on the image.

        An array of Point objects makes up a Polygon . A Polygon is returned by DetectText and by DetectCustomLabels Polygon represents a fine-grained polygon around a detected item. For more information, see Geometry in the Amazon Rekognition Developer Guide.

        • X (float) --

          The value of the X coordinate for a point on a Polygon .

        • Y (float) --

          The value of the Y coordinate for a point on a Polygon .

type DataSharingPreferenceForUpdate

dict

param DataSharingPreferenceForUpdate

Shows whether you are sharing data with Rekognition to improve model performance. You can choose this option at the account level or on a per-stream basis. Note that if you opt out at the account level this setting is ignored on individual streams.

  • OptIn (boolean) -- [REQUIRED]

    If this option is set to true, you choose to share data with Rekognition to improve model performance.

type ParametersToDelete

list

param ParametersToDelete

A list of parameters you want to delete from the stream processor.

  • (string) --

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

CreateStreamProcessor (updated) Link ¶
Changes (request)
{'DataSharingPreference': {'OptIn': 'boolean'},
 'KmsKeyId': 'string',
 'NotificationChannel': {'SNSTopicArn': 'string'},
 'Output': {'S3Destination': {'Bucket': 'string', 'KeyPrefix': 'string'}},
 'RegionsOfInterest': [{'BoundingBox': {'Height': 'float',
                                        'Left': 'float',
                                        'Top': 'float',
                                        'Width': 'float'},
                        'Polygon': [{'X': 'float', 'Y': 'float'}]}],
 'Settings': {'ConnectedHome': {'Labels': ['string'],
                                'MinConfidence': 'float'}}}

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

Amazon Rekognition Video is a consumer of live video from Amazon Kinesis Video Streams. There are two different settings for stream processors in Amazon Rekognition: detecting faces and detecting labels.

  • If you are creating a stream processor for detecting faces, 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. After you have finished analyzing a streaming video, use StopStreamProcessor to stop processing.

  • If you are creating a stream processor to detect labels, you provide as input a Kinesis video stream ( Input ), Amazon S3 bucket information ( Output ), and an Amazon SNS topic ARN ( NotificationChannel ). You can also provide a KMS key ID to encrypt the data sent to your Amazon S3 bucket. You specify what you want to detect in ConnectedHomeSettings , such as people, packages and people, or pets, people, and packages. You can also specify where in the frame you want Amazon Rekognition to monitor with RegionsOfInterest . When you run the StartStreamProcessor operation on a label detection stream processor, you input start and stop information to determine the length of the processing time.

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.

This operation requires permissions to perform the rekognition:CreateStreamProcessor action. If you want to tag your stream processor, you also require permission to perform the rekognition:TagResource operation.

See also: AWS API Documentation

Request Syntax

client.create_stream_processor(
    Input={
        'KinesisVideoStream': {
            'Arn': 'string'
        }
    },
    Output={
        'KinesisDataStream': {
            'Arn': 'string'
        },
        'S3Destination': {
            'Bucket': 'string',
            'KeyPrefix': 'string'
        }
    },
    Name='string',
    Settings={
        'FaceSearch': {
            'CollectionId': 'string',
            'FaceMatchThreshold': ...
        },
        'ConnectedHome': {
            'Labels': [
                'string',
            ],
            'MinConfidence': ...
        }
    },
    RoleArn='string',
    Tags={
        'string': 'string'
    },
    NotificationChannel={
        'SNSTopicArn': 'string'
    },
    KmsKeyId='string',
    RegionsOfInterest=[
        {
            'BoundingBox': {
                'Width': ...,
                'Height': ...,
                'Left': ...,
                'Top': ...
            },
            'Polygon': [
                {
                    'X': ...,
                    'Y': ...
                },
            ]
        },
    ],
    DataSharingPreference={
        'OptIn': True|False
    }
)
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 . This is required for both face search and label detection stream processors.

  • 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 or Amazon S3 bucket location to which Amazon Rekognition Video puts the analysis results. If you are using the AWS CLI, the parameter name is StreamProcessorOutput . This must be a S3Destination of an Amazon S3 bucket that you own for a label detection stream processor or a Kinesis data stream ARN for a face search stream processor.

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

  • S3Destination (dict) --

    The Amazon S3 bucket location to which Amazon Rekognition publishes the detailed inference results of a video analysis operation.

    • Bucket (string) --

      The name of the Amazon S3 bucket you want to associate with the streaming video project. You must be the owner of the Amazon S3 bucket.

    • KeyPrefix (string) --

      The prefix value of the location within the bucket that you want the information to be published to. For more information, see Using prefixes.

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. This is required for both face search and label detection stream processors.

type Settings

dict

param Settings

[REQUIRED]

Input parameters used in a streaming video analyzed by a stream processor. You can use FaceSearch to recognize faces in a streaming video, or you can use ConnectedHome to detect labels.

  • 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. The default is 80. 0 is the lowest confidence. 100 is the highest confidence. Values between 0 and 100 are accepted, and values lower than 80 are set to 80.

  • ConnectedHome (dict) --

    Label detection settings to use on a streaming video. Defining the settings is required in the request parameter for CreateStreamProcessor. Including this setting in the CreateStreamProcessor request enables you to use the stream processor for label detection. You can then select what you want the stream processor to detect, such as people or pets. When the stream processor has started, one notification is sent for each object class specified. For example, if packages and pets are selected, one SNS notification is published the first time a package is detected and one SNS notification is published the first time a pet is detected, as well as an end-of-session summary.

    • Labels (list) -- [REQUIRED]

      Specifies what you want to detect in the video, such as people, packages, or pets. The current valid labels you can include in this list are: "PERSON", "PET", "PACKAGE", and "ALL".

      • (string) --

    • MinConfidence (float) --

      The minimum confidence required to label an object in the video.

type RoleArn

string

param RoleArn

[REQUIRED]

The Amazon Resource Number (ARN) of the IAM role that allows access to the stream processor. The IAM role provides Rekognition read permissions for a Kinesis stream. It also provides write permissions to an Amazon S3 bucket and Amazon Simple Notification Service topic for a label detection stream processor. This is required for both face search and label detection stream processors.

type Tags

dict

param Tags

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

  • (string) --

    • (string) --

type NotificationChannel

dict

param NotificationChannel

The Amazon Simple Notification Service topic to which Amazon Rekognition publishes the object detection results and completion status of a video analysis operation.

Amazon Rekognition publishes a notification the first time an object of interest or a person is detected in the video stream. For example, if Amazon Rekognition detects a person at second 2, a pet at second 4, and a person again at second 5, Amazon Rekognition sends 2 object class detected notifications, one for a person at second 2 and one for a pet at second 4.

Amazon Rekognition also publishes an an end-of-session notification with a summary when the stream processing session is complete.

  • SNSTopicArn (string) -- [REQUIRED]

    The Amazon Resource Number (ARN) of the Amazon Amazon Simple Notification Service topic to which Amazon Rekognition posts the completion status.

type KmsKeyId

string

param KmsKeyId

The identifier for your AWS Key Management Service key (AWS KMS key). This is an optional parameter for label detection stream processors and should not be used to create a face search stream processor. You can supply the Amazon Resource Name (ARN) of your KMS key, the ID of your KMS key, an alias for your KMS key, or an alias ARN. The key is used to encrypt results and data published to your Amazon S3 bucket, which includes image frames and hero images. Your source images are unaffected.

type RegionsOfInterest

list

param RegionsOfInterest

Specifies locations in the frames where Amazon Rekognition checks for objects or people. You can specify up to 10 regions of interest. This is an optional parameter for label detection stream processors and should not be used to create a face search stream processor.

  • (dict) --

    Specifies a location within the frame that Rekognition checks for objects of interest such as text, labels, or faces. It uses a BoundingBox or object or Polygon to set a region of the screen.

    A word, face, or label is included in the region if it is more than half in that region. If there is more than one region, the word, face, or label is compared with all regions of the screen. Any object of interest that is more than half in a region is kept in the results.

    • BoundingBox (dict) --

      The box representing a region of interest on screen.

      • Width (float) --

        Width of the bounding box as a ratio of the overall image width.

      • Height (float) --

        Height of the bounding box as a ratio of the overall image height.

      • Left (float) --

        Left coordinate of the bounding box as a ratio of overall image width.

      • Top (float) --

        Top coordinate of the bounding box as a ratio of overall image height.

    • Polygon (list) --

      Specifies a shape made up of up to 10 Point objects to define a region of interest.

      • (dict) --

        The X and Y coordinates of a point on an image or video frame. The X and Y values are ratios of the overall image size or video resolution. For example, if an input image is 700x200 and the values are X=0.5 and Y=0.25, then the point is at the (350,50) pixel coordinate on the image.

        An array of Point objects makes up a Polygon . A Polygon is returned by DetectText and by DetectCustomLabels Polygon represents a fine-grained polygon around a detected item. For more information, see Geometry in the Amazon Rekognition Developer Guide.

        • X (float) --

          The value of the X coordinate for a point on a Polygon .

        • Y (float) --

          The value of the Y coordinate for a point on a Polygon .

type DataSharingPreference

dict

param DataSharingPreference

Shows whether you are sharing data with Rekognition to improve model performance. You can choose this option at the account level or on a per-stream basis. Note that if you opt out at the account level this setting is ignored on individual streams.

  • OptIn (boolean) -- [REQUIRED]

    If this option is set to true, you choose to share data with Rekognition to improve model performance.

rtype

dict

returns

Response Syntax

{
    'StreamProcessorArn': 'string'
}

Response Structure

  • (dict) --

    • StreamProcessorArn (string) --

      Amazon Resource Number for the newly created stream processor.

DescribeStreamProcessor (updated) Link ¶
Changes (response)
{'DataSharingPreference': {'OptIn': 'boolean'},
 'KmsKeyId': 'string',
 'NotificationChannel': {'SNSTopicArn': 'string'},
 'Output': {'S3Destination': {'Bucket': 'string', 'KeyPrefix': 'string'}},
 'RegionsOfInterest': [{'BoundingBox': {'Height': 'float',
                                        'Left': 'float',
                                        'Top': 'float',
                                        'Width': 'float'},
                        'Polygon': [{'X': 'float', 'Y': 'float'}]}],
 'Settings': {'ConnectedHome': {'Labels': ['string'],
                                'MinConfidence': 'float'}},
 'Status': {'UPDATING'}}

Provides information about a stream processor created by CreateStreamProcessor. You can get information about the input and output streams, the input parameters for the face recognition being performed, and the current status of the stream processor.

See also: AWS API Documentation

Request Syntax

client.describe_stream_processor(
    Name='string'
)
type Name

string

param Name

[REQUIRED]

Name of the stream processor for which you want information.

rtype

dict

returns

Response Syntax

{
    'Name': 'string',
    'StreamProcessorArn': 'string',
    'Status': 'STOPPED'|'STARTING'|'RUNNING'|'FAILED'|'STOPPING'|'UPDATING',
    'StatusMessage': 'string',
    'CreationTimestamp': datetime(2015, 1, 1),
    'LastUpdateTimestamp': datetime(2015, 1, 1),
    'Input': {
        'KinesisVideoStream': {
            'Arn': 'string'
        }
    },
    'Output': {
        'KinesisDataStream': {
            'Arn': 'string'
        },
        'S3Destination': {
            'Bucket': 'string',
            'KeyPrefix': 'string'
        }
    },
    'RoleArn': 'string',
    'Settings': {
        'FaceSearch': {
            'CollectionId': 'string',
            'FaceMatchThreshold': ...
        },
        'ConnectedHome': {
            'Labels': [
                'string',
            ],
            'MinConfidence': ...
        }
    },
    'NotificationChannel': {
        'SNSTopicArn': 'string'
    },
    'KmsKeyId': 'string',
    'RegionsOfInterest': [
        {
            'BoundingBox': {
                'Width': ...,
                'Height': ...,
                'Left': ...,
                'Top': ...
            },
            'Polygon': [
                {
                    'X': ...,
                    'Y': ...
                },
            ]
        },
    ],
    'DataSharingPreference': {
        'OptIn': True|False
    }
}

Response Structure

  • (dict) --

    • Name (string) --

      Name of the stream processor.

    • StreamProcessorArn (string) --

      ARN of the stream processor.

    • Status (string) --

      Current status of the stream processor.

    • StatusMessage (string) --

      Detailed status message about the stream processor.

    • CreationTimestamp (datetime) --

      Date and time the stream processor was created

    • LastUpdateTimestamp (datetime) --

      The time, in Unix format, the stream processor was last updated. For example, when the stream processor moves from a running state to a failed state, or when the user starts or stops the stream processor.

    • Input (dict) --

      Kinesis video stream that provides the source streaming video.

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

    • Output (dict) --

      Kinesis data stream to which Amazon Rekognition Video puts the analysis results.

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

      • S3Destination (dict) --

        The Amazon S3 bucket location to which Amazon Rekognition publishes the detailed inference results of a video analysis operation.

        • Bucket (string) --

          The name of the Amazon S3 bucket you want to associate with the streaming video project. You must be the owner of the Amazon S3 bucket.

        • KeyPrefix (string) --

          The prefix value of the location within the bucket that you want the information to be published to. For more information, see Using prefixes.

    • RoleArn (string) --

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

    • Settings (dict) --

      Input parameters used in a streaming video analyzed by a stream processor. You can use FaceSearch to recognize faces in a streaming video, or you can use ConnectedHome to detect labels.

      • 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. The default is 80. 0 is the lowest confidence. 100 is the highest confidence. Values between 0 and 100 are accepted, and values lower than 80 are set to 80.

      • ConnectedHome (dict) --

        Label detection settings to use on a streaming video. Defining the settings is required in the request parameter for CreateStreamProcessor. Including this setting in the CreateStreamProcessor request enables you to use the stream processor for label detection. You can then select what you want the stream processor to detect, such as people or pets. When the stream processor has started, one notification is sent for each object class specified. For example, if packages and pets are selected, one SNS notification is published the first time a package is detected and one SNS notification is published the first time a pet is detected, as well as an end-of-session summary.

        • Labels (list) --

          Specifies what you want to detect in the video, such as people, packages, or pets. The current valid labels you can include in this list are: "PERSON", "PET", "PACKAGE", and "ALL".

          • (string) --

        • MinConfidence (float) --

          The minimum confidence required to label an object in the video.

    • NotificationChannel (dict) --

      The Amazon Simple Notification Service topic to which Amazon Rekognition publishes the object detection results and completion status of a video analysis operation.

      Amazon Rekognition publishes a notification the first time an object of interest or a person is detected in the video stream. For example, if Amazon Rekognition detects a person at second 2, a pet at second 4, and a person again at second 5, Amazon Rekognition sends 2 object class detected notifications, one for a person at second 2 and one for a pet at second 4.

      Amazon Rekognition also publishes an an end-of-session notification with a summary when the stream processing session is complete.

      • SNSTopicArn (string) --

        The Amazon Resource Number (ARN) of the Amazon Amazon Simple Notification Service topic to which Amazon Rekognition posts the completion status.

    • KmsKeyId (string) --

      The identifier for your AWS Key Management Service key (AWS KMS key). This is an optional parameter for label detection stream processors.

    • RegionsOfInterest (list) --

      Specifies locations in the frames where Amazon Rekognition checks for objects or people. This is an optional parameter for label detection stream processors.

      • (dict) --

        Specifies a location within the frame that Rekognition checks for objects of interest such as text, labels, or faces. It uses a BoundingBox or object or Polygon to set a region of the screen.

        A word, face, or label is included in the region if it is more than half in that region. If there is more than one region, the word, face, or label is compared with all regions of the screen. Any object of interest that is more than half in a region is kept in the results.

        • BoundingBox (dict) --

          The box representing a region of interest on screen.

          • Width (float) --

            Width of the bounding box as a ratio of the overall image width.

          • Height (float) --

            Height of the bounding box as a ratio of the overall image height.

          • Left (float) --

            Left coordinate of the bounding box as a ratio of overall image width.

          • Top (float) --

            Top coordinate of the bounding box as a ratio of overall image height.

        • Polygon (list) --

          Specifies a shape made up of up to 10 Point objects to define a region of interest.

          • (dict) --

            The X and Y coordinates of a point on an image or video frame. The X and Y values are ratios of the overall image size or video resolution. For example, if an input image is 700x200 and the values are X=0.5 and Y=0.25, then the point is at the (350,50) pixel coordinate on the image.

            An array of Point objects makes up a Polygon . A Polygon is returned by DetectText and by DetectCustomLabels Polygon represents a fine-grained polygon around a detected item. For more information, see Geometry in the Amazon Rekognition Developer Guide.

            • X (float) --

              The value of the X coordinate for a point on a Polygon .

            • Y (float) --

              The value of the Y coordinate for a point on a Polygon .

    • DataSharingPreference (dict) --

      Shows whether you are sharing data with Rekognition to improve model performance. You can choose this option at the account level or on a per-stream basis. Note that if you opt out at the account level this setting is ignored on individual streams.

      • OptIn (boolean) --

        If this option is set to true, you choose to share data with Rekognition to improve model performance.

DetectText (updated) Link ¶
Changes (request)
{'Filters': {'RegionsOfInterest': {'Polygon': [{'X': 'float', 'Y': 'float'}]}}}

Detects text in the input image and converts it into machine-readable text.

Pass the input image 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, you must pass it as a reference to an image in an Amazon S3 bucket. For the AWS CLI, passing image bytes is not supported. The image must be either a .png or .jpeg formatted file.

The DetectText operation returns text in an array of TextDetection elements, TextDetections . Each TextDetection element provides information about a single word or line of text that was detected in the image.

A word is one or more script characters that are not separated by spaces. DetectText can detect up to 100 words in an image.

A line is a string of equally spaced words. A line isn't necessarily a complete sentence. For example, a driver's license number is detected as a line. A line ends when there is no aligned text after it. Also, a line ends when there is a large gap between words, relative to the length of the words. This means, depending on the gap between words, Amazon Rekognition may detect multiple lines in text aligned in the same direction. Periods don't represent the end of a line. If a sentence spans multiple lines, the DetectText operation returns multiple lines.

To determine whether a TextDetection element is a line of text or a word, use the TextDetection object Type field.

To be detected, text must be within +/- 90 degrees orientation of the horizontal axis.

For more information, see Detecting text in the Amazon Rekognition Developer Guide.

See also: AWS API Documentation

Request Syntax

client.detect_text(
    Image={
        'Bytes': b'bytes',
        'S3Object': {
            'Bucket': 'string',
            'Name': 'string',
            'Version': 'string'
        }
    },
    Filters={
        'WordFilter': {
            'MinConfidence': ...,
            'MinBoundingBoxHeight': ...,
            'MinBoundingBoxWidth': ...
        },
        'RegionsOfInterest': [
            {
                'BoundingBox': {
                    'Width': ...,
                    'Height': ...,
                    'Left': ...,
                    'Top': ...
                },
                'Polygon': [
                    {
                        'X': ...,
                        'Y': ...
                    },
                ]
            },
        ]
    }
)
type Image

dict

param Image

[REQUIRED]

The input image as base64-encoded bytes or an Amazon S3 object. If you use the AWS CLI to call Amazon Rekognition operations, you can't pass image bytes.

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 in the Amazon Rekognition developer guide.

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

dict

param Filters

Optional parameters that let you set the criteria that the text must meet to be included in your response.

  • WordFilter (dict) --

    A set of parameters that allow you to filter out certain results from your returned results.

    • MinConfidence (float) --

      Sets the confidence of word detection. Words with detection confidence below this will be excluded from the result. Values should be between 0 and 100. The default MinConfidence is 80.

    • MinBoundingBoxHeight (float) --

      Sets the minimum height of the word bounding box. Words with bounding box heights lesser than this value will be excluded from the result. Value is relative to the video frame height.

    • MinBoundingBoxWidth (float) --

      Sets the minimum width of the word bounding box. Words with bounding boxes widths lesser than this value will be excluded from the result. Value is relative to the video frame width.

  • RegionsOfInterest (list) --

    A Filter focusing on a certain area of the image. Uses a BoundingBox object to set the region of the image.

    • (dict) --

      Specifies a location within the frame that Rekognition checks for objects of interest such as text, labels, or faces. It uses a BoundingBox or object or Polygon to set a region of the screen.

      A word, face, or label is included in the region if it is more than half in that region. If there is more than one region, the word, face, or label is compared with all regions of the screen. Any object of interest that is more than half in a region is kept in the results.

      • BoundingBox (dict) --

        The box representing a region of interest on screen.

        • Width (float) --

          Width of the bounding box as a ratio of the overall image width.

        • Height (float) --

          Height of the bounding box as a ratio of the overall image height.

        • Left (float) --

          Left coordinate of the bounding box as a ratio of overall image width.

        • Top (float) --

          Top coordinate of the bounding box as a ratio of overall image height.

      • Polygon (list) --

        Specifies a shape made up of up to 10 Point objects to define a region of interest.

        • (dict) --

          The X and Y coordinates of a point on an image or video frame. The X and Y values are ratios of the overall image size or video resolution. For example, if an input image is 700x200 and the values are X=0.5 and Y=0.25, then the point is at the (350,50) pixel coordinate on the image.

          An array of Point objects makes up a Polygon . A Polygon is returned by DetectText and by DetectCustomLabels Polygon represents a fine-grained polygon around a detected item. For more information, see Geometry in the Amazon Rekognition Developer Guide.

          • X (float) --

            The value of the X coordinate for a point on a Polygon .

          • Y (float) --

            The value of the Y coordinate for a point on a Polygon .

rtype

dict

returns

Response Syntax

{
    'TextDetections': [
        {
            'DetectedText': 'string',
            'Type': 'LINE'|'WORD',
            'Id': 123,
            'ParentId': 123,
            'Confidence': ...,
            'Geometry': {
                'BoundingBox': {
                    'Width': ...,
                    'Height': ...,
                    'Left': ...,
                    'Top': ...
                },
                'Polygon': [
                    {
                        'X': ...,
                        'Y': ...
                    },
                ]
            }
        },
    ],
    'TextModelVersion': 'string'
}

Response Structure

  • (dict) --

    • TextDetections (list) --

      An array of text that was detected in the input image.

      • (dict) --

        Information about a word or line of text detected by DetectText.

        The DetectedText field contains the text that Amazon Rekognition detected in the image.

        Every word and line has an identifier ( Id ). Each word belongs to a line and has a parent identifier ( ParentId ) that identifies the line of text in which the word appears. The word Id is also an index for the word within a line of words.

        For more information, see Detecting text in the Amazon Rekognition Developer Guide.

        • DetectedText (string) --

          The word or line of text recognized by Amazon Rekognition.

        • Type (string) --

          The type of text that was detected.

        • Id (integer) --

          The identifier for the detected text. The identifier is only unique for a single call to DetectText .

        • ParentId (integer) --

          The Parent identifier for the detected text identified by the value of ID . If the type of detected text is LINE , the value of ParentId is Null .

        • Confidence (float) --

          The confidence that Amazon Rekognition has in the accuracy of the detected text and the accuracy of the geometry points around the detected text.

        • Geometry (dict) --

          The location of the detected text on the image. Includes an axis aligned coarse bounding box surrounding the text and a finer grain polygon for more accurate spatial information.

          • BoundingBox (dict) --

            An axis-aligned coarse representation of the detected item's location on the image.

            • Width (float) --

              Width of the bounding box as a ratio of the overall image width.

            • Height (float) --

              Height of the bounding box as a ratio of the overall image height.

            • Left (float) --

              Left coordinate of the bounding box as a ratio of overall image width.

            • Top (float) --

              Top coordinate of the bounding box as a ratio of overall image height.

          • Polygon (list) --

            Within the bounding box, a fine-grained polygon around the detected item.

            • (dict) --

              The X and Y coordinates of a point on an image or video frame. The X and Y values are ratios of the overall image size or video resolution. For example, if an input image is 700x200 and the values are X=0.5 and Y=0.25, then the point is at the (350,50) pixel coordinate on the image.

              An array of Point objects makes up a Polygon . A Polygon is returned by DetectText and by DetectCustomLabels Polygon represents a fine-grained polygon around a detected item. For more information, see Geometry in the Amazon Rekognition Developer Guide.

              • X (float) --

                The value of the X coordinate for a point on a Polygon .

              • Y (float) --

                The value of the Y coordinate for a point on a Polygon .

    • TextModelVersion (string) --

      The model version used to detect text.

ListStreamProcessors (updated) Link ¶
Changes (response)
{'StreamProcessors': {'Status': {'UPDATING'}}}

Gets a list of stream processors that you have created with CreateStreamProcessor.

See also: AWS API Documentation

Request Syntax

client.list_stream_processors(
    NextToken='string',
    MaxResults=123
)
type NextToken

string

param NextToken

If the previous response was incomplete (because there are more stream processors to retrieve), Amazon Rekognition Video returns a pagination token in the response. You can use this pagination token to retrieve the next set of stream processors.

type MaxResults

integer

param MaxResults

Maximum number of stream processors you want Amazon Rekognition Video to return in the response. The default is 1000.

rtype

dict

returns

Response Syntax

{
    'NextToken': 'string',
    'StreamProcessors': [
        {
            'Name': 'string',
            'Status': 'STOPPED'|'STARTING'|'RUNNING'|'FAILED'|'STOPPING'|'UPDATING'
        },
    ]
}

Response Structure

  • (dict) --

    • NextToken (string) --

      If the response is truncated, Amazon Rekognition Video returns this token that you can use in the subsequent request to retrieve the next set of stream processors.

    • StreamProcessors (list) --

      List of stream processors that you have created.

      • (dict) --

        An object that recognizes faces or labels in a streaming video. An Amazon Rekognition stream processor is created by a call to CreateStreamProcessor. The request parameters for CreateStreamProcessor describe the Kinesis video stream source for the streaming video, face recognition parameters, and where to stream the analysis resullts.

        • Name (string) --

          Name of the Amazon Rekognition stream processor.

        • Status (string) --

          Current status of the Amazon Rekognition stream processor.

StartStreamProcessor (updated) Link ¶
Changes (request, response)
Request
{'StartSelector': {'KVSStreamStartSelector': {'FragmentNumber': 'string',
                                              'ProducerTimestamp': 'long'}},
 'StopSelector': {'MaxDurationInSeconds': 'long'}}
Response
{'SessionId': 'string'}

Starts processing a stream processor. You create a stream processor by calling CreateStreamProcessor. To tell StartStreamProcessor which stream processor to start, use the value of the Name field specified in the call to CreateStreamProcessor .

If you are using a label detection stream processor to detect labels, you need to provide a Start selector and a Stop selector to determine the length of the stream processing time.

See also: AWS API Documentation

Request Syntax

client.start_stream_processor(
    Name='string',
    StartSelector={
        'KVSStreamStartSelector': {
            'ProducerTimestamp': 123,
            'FragmentNumber': 'string'
        }
    },
    StopSelector={
        'MaxDurationInSeconds': 123
    }
)
type Name

string

param Name

[REQUIRED]

The name of the stream processor to start processing.

type StartSelector

dict

param StartSelector

Specifies the starting point in the Kinesis stream to start processing. You can use the producer timestamp or the fragment number. For more information, see Fragment.

This is a required parameter for label detection stream processors and should not be used to start a face search stream processor.

  • KVSStreamStartSelector (dict) --

    Specifies the starting point in the stream to start processing. This can be done with a timestamp or a fragment number in a Kinesis stream.

    • ProducerTimestamp (integer) --

      The timestamp from the producer corresponding to the fragment.

    • FragmentNumber (string) --

      The unique identifier of the fragment. This value monotonically increases based on the ingestion order.

type StopSelector

dict

param StopSelector

Specifies when to stop processing the stream. You can specify a maximum amount of time to process the video.

This is a required parameter for label detection stream processors and should not be used to start a face search stream processor.

  • MaxDurationInSeconds (integer) --

    Specifies the maximum amount of time in seconds that you want the stream to be processed. The largest amount of time is 2 minutes. The default is 10 seconds.

rtype

dict

returns

Response Syntax

{
    'SessionId': 'string'
}

Response Structure

  • (dict) --

    • SessionId (string) --

      A unique identifier for the stream processing session.

StartTextDetection (updated) Link ¶
Changes (request)
{'Filters': {'RegionsOfInterest': {'Polygon': [{'X': 'float', 'Y': 'float'}]}}}

Starts asynchronous detection of text in a stored video.

Amazon Rekognition Video can detect text in a video stored in an Amazon S3 bucket. Use Video to specify the bucket name and the filename of the video. StartTextDetection returns a job identifier ( JobId ) which you use to get the results of the operation. When text detection is finished, Amazon Rekognition Video publishes a completion status to the Amazon Simple Notification Service topic that you specify in NotificationChannel .

To get the results of the text detection operation, first check that the status value published to the Amazon SNS topic is SUCCEEDED . if so, call GetTextDetection and pass the job identifier ( JobId ) from the initial call to StartTextDetection .

See also: AWS API Documentation

Request Syntax

client.start_text_detection(
    Video={
        'S3Object': {
            'Bucket': 'string',
            'Name': 'string',
            'Version': 'string'
        }
    },
    ClientRequestToken='string',
    NotificationChannel={
        'SNSTopicArn': 'string',
        'RoleArn': 'string'
    },
    JobTag='string',
    Filters={
        'WordFilter': {
            'MinConfidence': ...,
            'MinBoundingBoxHeight': ...,
            'MinBoundingBoxWidth': ...
        },
        'RegionsOfInterest': [
            {
                'BoundingBox': {
                    'Width': ...,
                    'Height': ...,
                    'Left': ...,
                    'Top': ...
                },
                'Polygon': [
                    {
                        'X': ...,
                        'Y': ...
                    },
                ]
            },
        ]
    }
)
type Video

dict

param Video

[REQUIRED]

Video file stored in an Amazon S3 bucket. Amazon Rekognition video start operations such as StartLabelDetection use Video to specify a video for analysis. The supported file formats are .mp4, .mov and .avi.

  • S3Object (dict) --

    The Amazon S3 bucket name and file name for the video.

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

string

param ClientRequestToken

Idempotent token used to identify the start request. If you use the same token with multiple StartTextDetection requests, the same JobId is returned. Use ClientRequestToken to prevent the same job from being accidentaly started more than once.

type NotificationChannel

dict

param NotificationChannel

The Amazon Simple Notification Service topic to which Amazon Rekognition publishes the completion status of a video analysis operation. For more information, see Calling Amazon Rekognition Video operations. Note that the Amazon SNS topic must have a topic name that begins with AmazonRekognition if you are using the AmazonRekognitionServiceRole permissions policy to access the topic. For more information, see Giving access to multiple Amazon SNS topics.

  • SNSTopicArn (string) -- [REQUIRED]

    The Amazon SNS topic to which Amazon Rekognition posts the completion status.

  • RoleArn (string) -- [REQUIRED]

    The ARN of an IAM role that gives Amazon Rekognition publishing permissions to the Amazon SNS topic.

type JobTag

string

param JobTag

An identifier returned in the completion status published by your Amazon Simple Notification Service topic. For example, you can use JobTag to group related jobs and identify them in the completion notification.

type Filters

dict

param Filters

Optional parameters that let you set criteria the text must meet to be included in your response.

  • WordFilter (dict) --

    Filters focusing on qualities of the text, such as confidence or size.

    • MinConfidence (float) --

      Sets the confidence of word detection. Words with detection confidence below this will be excluded from the result. Values should be between 0 and 100. The default MinConfidence is 80.

    • MinBoundingBoxHeight (float) --

      Sets the minimum height of the word bounding box. Words with bounding box heights lesser than this value will be excluded from the result. Value is relative to the video frame height.

    • MinBoundingBoxWidth (float) --

      Sets the minimum width of the word bounding box. Words with bounding boxes widths lesser than this value will be excluded from the result. Value is relative to the video frame width.

  • RegionsOfInterest (list) --

    Filter focusing on a certain area of the frame. Uses a BoundingBox object to set the region of the screen.

    • (dict) --

      Specifies a location within the frame that Rekognition checks for objects of interest such as text, labels, or faces. It uses a BoundingBox or object or Polygon to set a region of the screen.

      A word, face, or label is included in the region if it is more than half in that region. If there is more than one region, the word, face, or label is compared with all regions of the screen. Any object of interest that is more than half in a region is kept in the results.

      • BoundingBox (dict) --

        The box representing a region of interest on screen.

        • Width (float) --

          Width of the bounding box as a ratio of the overall image width.

        • Height (float) --

          Height of the bounding box as a ratio of the overall image height.

        • Left (float) --

          Left coordinate of the bounding box as a ratio of overall image width.

        • Top (float) --

          Top coordinate of the bounding box as a ratio of overall image height.

      • Polygon (list) --

        Specifies a shape made up of up to 10 Point objects to define a region of interest.

        • (dict) --

          The X and Y coordinates of a point on an image or video frame. The X and Y values are ratios of the overall image size or video resolution. For example, if an input image is 700x200 and the values are X=0.5 and Y=0.25, then the point is at the (350,50) pixel coordinate on the image.

          An array of Point objects makes up a Polygon . A Polygon is returned by DetectText and by DetectCustomLabels Polygon represents a fine-grained polygon around a detected item. For more information, see Geometry in the Amazon Rekognition Developer Guide.

          • X (float) --

            The value of the X coordinate for a point on a Polygon .

          • Y (float) --

            The value of the Y coordinate for a point on a Polygon .

rtype

dict

returns

Response Syntax

{
    'JobId': 'string'
}

Response Structure

  • (dict) --

    • JobId (string) --

      Identifier for the text detection job. Use JobId to identify the job in a subsequent call to GetTextDetection .