Amazon Rekognition

2021/08/09 - Amazon Rekognition - 9 updated api methods

Changes  This release adds support for four new types of segments (opening credits, content segments, slates, and studio logos), improved accuracy for credits and shot detection and new filters to control black frame detection.

GetCelebrityRecognition (updated) Link ¶
Changes (response)
{'VideoMetadata': {'ColorRange': 'FULL | LIMITED'}}

Gets the celebrity recognition results for a Amazon Rekognition Video analysis started by StartCelebrityRecognition.

Celebrity recognition in a video is an asynchronous operation. Analysis is started by a call to StartCelebrityRecognition which returns a job identifier ( JobId ). When the celebrity recognition operation finishes, Amazon Rekognition Video publishes a completion status to the Amazon Simple Notification Service topic registered in the initial call to StartCelebrityRecognition . To get the results of the celebrity recognition analysis, first check that the status value published to the Amazon SNS topic is SUCCEEDED . If so, call GetCelebrityDetection and pass the job identifier ( JobId ) from the initial call to StartCelebrityDetection .

For more information, see Working With Stored Videos in the Amazon Rekognition Developer Guide.

GetCelebrityRecognition returns detected celebrities and the time(s) they are detected in an array ( Celebrities ) of CelebrityRecognition objects. Each CelebrityRecognition contains information about the celebrity in a CelebrityDetail object and the time, Timestamp , the celebrity was detected.

Note

GetCelebrityRecognition only returns the default facial attributes ( BoundingBox , Confidence , Landmarks , Pose , and Quality ). The other facial attributes listed in the Face object of the following response syntax are not returned. For more information, see FaceDetail in the Amazon Rekognition Developer Guide.

By default, the Celebrities array is sorted by time (milliseconds from the start of the video). You can also sort the array by celebrity by specifying the value ID in the SortBy input parameter.

The CelebrityDetail object includes the celebrity identifer and additional information urls. If you don't store the additional information urls, you can get them later by calling GetCelebrityInfo with the celebrity identifer.

No information is returned for faces not recognized as celebrities.

Use MaxResults parameter to limit the number of labels returned. If there are more results than specified in MaxResults , the value of NextToken in the operation response contains a pagination token for getting the next set of results. To get the next page of results, call GetCelebrityDetection and populate the NextToken request parameter with the token value returned from the previous call to GetCelebrityRecognition .

See also: AWS API Documentation

Request Syntax

client.get_celebrity_recognition(
    JobId='string',
    MaxResults=123,
    NextToken='string',
    SortBy='ID'|'TIMESTAMP'
)
type JobId

string

param JobId

[REQUIRED]

Job identifier for the required celebrity recognition analysis. You can get the job identifer from a call to StartCelebrityRecognition .

type MaxResults

integer

param MaxResults

Maximum number of results to return per paginated call. The largest value you can specify is 1000. If you specify a value greater than 1000, a maximum of 1000 results is returned. The default value is 1000.

type NextToken

string

param NextToken

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

type SortBy

string

param SortBy

Sort to use for celebrities returned in Celebrities field. Specify ID to sort by the celebrity identifier, specify TIMESTAMP to sort by the time the celebrity was recognized.

rtype

dict

returns

Response Syntax

{
    'JobStatus': 'IN_PROGRESS'|'SUCCEEDED'|'FAILED',
    'StatusMessage': 'string',
    'VideoMetadata': {
        'Codec': 'string',
        'DurationMillis': 123,
        'Format': 'string',
        'FrameRate': ...,
        'FrameHeight': 123,
        'FrameWidth': 123,
        'ColorRange': 'FULL'|'LIMITED'
    },
    'NextToken': 'string',
    'Celebrities': [
        {
            'Timestamp': 123,
            'Celebrity': {
                'Urls': [
                    'string',
                ],
                'Name': 'string',
                'Id': 'string',
                'Confidence': ...,
                'BoundingBox': {
                    'Width': ...,
                    'Height': ...,
                    'Left': ...,
                    'Top': ...
                },
                'Face': {
                    'BoundingBox': {
                        'Width': ...,
                        'Height': ...,
                        'Left': ...,
                        'Top': ...
                    },
                    'AgeRange': {
                        'Low': 123,
                        'High': 123
                    },
                    'Smile': {
                        'Value': True|False,
                        'Confidence': ...
                    },
                    'Eyeglasses': {
                        'Value': True|False,
                        'Confidence': ...
                    },
                    'Sunglasses': {
                        'Value': True|False,
                        'Confidence': ...
                    },
                    'Gender': {
                        'Value': 'Male'|'Female',
                        'Confidence': ...
                    },
                    'Beard': {
                        'Value': True|False,
                        'Confidence': ...
                    },
                    'Mustache': {
                        'Value': True|False,
                        'Confidence': ...
                    },
                    'EyesOpen': {
                        'Value': True|False,
                        'Confidence': ...
                    },
                    'MouthOpen': {
                        'Value': True|False,
                        'Confidence': ...
                    },
                    'Emotions': [
                        {
                            'Type': 'HAPPY'|'SAD'|'ANGRY'|'CONFUSED'|'DISGUSTED'|'SURPRISED'|'CALM'|'UNKNOWN'|'FEAR',
                            'Confidence': ...
                        },
                    ],
                    'Landmarks': [
                        {
                            'Type': 'eyeLeft'|'eyeRight'|'nose'|'mouthLeft'|'mouthRight'|'leftEyeBrowLeft'|'leftEyeBrowRight'|'leftEyeBrowUp'|'rightEyeBrowLeft'|'rightEyeBrowRight'|'rightEyeBrowUp'|'leftEyeLeft'|'leftEyeRight'|'leftEyeUp'|'leftEyeDown'|'rightEyeLeft'|'rightEyeRight'|'rightEyeUp'|'rightEyeDown'|'noseLeft'|'noseRight'|'mouthUp'|'mouthDown'|'leftPupil'|'rightPupil'|'upperJawlineLeft'|'midJawlineLeft'|'chinBottom'|'midJawlineRight'|'upperJawlineRight',
                            'X': ...,
                            'Y': ...
                        },
                    ],
                    'Pose': {
                        'Roll': ...,
                        'Yaw': ...,
                        'Pitch': ...
                    },
                    'Quality': {
                        'Brightness': ...,
                        'Sharpness': ...
                    },
                    'Confidence': ...
                }
            }
        },
    ]
}

Response Structure

  • (dict) --

    • JobStatus (string) --

      The current status of the celebrity recognition job.

    • StatusMessage (string) --

      If the job fails, StatusMessage provides a descriptive error message.

    • VideoMetadata (dict) --

      Information about a video that Amazon Rekognition Video analyzed. Videometadata is returned in every page of paginated responses from a Amazon Rekognition Video operation.

      • Codec (string) --

        Type of compression used in the analyzed video.

      • DurationMillis (integer) --

        Length of the video in milliseconds.

      • Format (string) --

        Format of the analyzed video. Possible values are MP4, MOV and AVI.

      • FrameRate (float) --

        Number of frames per second in the video.

      • FrameHeight (integer) --

        Vertical pixel dimension of the video.

      • FrameWidth (integer) --

        Horizontal pixel dimension of the video.

      • ColorRange (string) --

        A description of the range of luminance values in a video, either LIMITED (16 to 235) or FULL (0 to 255).

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

    • Celebrities (list) --

      Array of celebrities recognized in the video.

      • (dict) --

        Information about a detected celebrity and the time the celebrity was detected in a stored video. For more information, see GetCelebrityRecognition in the Amazon Rekognition Developer Guide.

        • Timestamp (integer) --

          The time, in milliseconds from the start of the video, that the celebrity was recognized.

        • Celebrity (dict) --

          Information about a recognized celebrity.

          • Urls (list) --

            An array of URLs pointing to additional celebrity information.

            • (string) --

          • Name (string) --

            The name of the celebrity.

          • Id (string) --

            The unique identifier for the celebrity.

          • Confidence (float) --

            The confidence, in percentage, that Amazon Rekognition has that the recognized face is the celebrity.

          • BoundingBox (dict) --

            Bounding box around the body of a celebrity.

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

          • Face (dict) --

            Face details for the recognized celebrity.

            • BoundingBox (dict) --

              Bounding box of the face. Default attribute.

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

            • AgeRange (dict) --

              The estimated age range, in years, for the face. Low represents the lowest estimated age and High represents the highest estimated age.

              • Low (integer) --

                The lowest estimated age.

              • High (integer) --

                The highest estimated age.

            • Smile (dict) --

              Indicates whether or not the face is smiling, and the confidence level in the determination.

              • Value (boolean) --

                Boolean value that indicates whether the face is smiling or not.

              • Confidence (float) --

                Level of confidence in the determination.

            • Eyeglasses (dict) --

              Indicates whether or not the face is wearing eye glasses, and the confidence level in the determination.

              • Value (boolean) --

                Boolean value that indicates whether the face is wearing eye glasses or not.

              • Confidence (float) --

                Level of confidence in the determination.

            • Sunglasses (dict) --

              Indicates whether or not the face is wearing sunglasses, and the confidence level in the determination.

              • Value (boolean) --

                Boolean value that indicates whether the face is wearing sunglasses or not.

              • Confidence (float) --

                Level of confidence in the determination.

            • Gender (dict) --

              The predicted gender of a detected face.

              • Value (string) --

                The predicted gender of the face.

              • Confidence (float) --

                Level of confidence in the prediction.

            • Beard (dict) --

              Indicates whether or not the face has a beard, and the confidence level in the determination.

              • Value (boolean) --

                Boolean value that indicates whether the face has beard or not.

              • Confidence (float) --

                Level of confidence in the determination.

            • Mustache (dict) --

              Indicates whether or not the face has a mustache, and the confidence level in the determination.

              • Value (boolean) --

                Boolean value that indicates whether the face has mustache or not.

              • Confidence (float) --

                Level of confidence in the determination.

            • EyesOpen (dict) --

              Indicates whether or not the eyes on the face are open, and the confidence level in the determination.

              • Value (boolean) --

                Boolean value that indicates whether the eyes on the face are open.

              • Confidence (float) --

                Level of confidence in the determination.

            • MouthOpen (dict) --

              Indicates whether or not the mouth on the face is open, and the confidence level in the determination.

              • Value (boolean) --

                Boolean value that indicates whether the mouth on the face is open or not.

              • Confidence (float) --

                Level of confidence in the determination.

            • Emotions (list) --

              The emotions that appear to be expressed on the face, and the confidence level in the determination. The API is only making a determination of the physical appearance of a person's face. It is not a determination of the person’s internal emotional state and should not be used in such a way. For example, a person pretending to have a sad face might not be sad emotionally.

              • (dict) --

                The emotions that appear to be expressed on the face, and the confidence level in the determination. The API is only making a determination of the physical appearance of a person's face. It is not a determination of the person’s internal emotional state and should not be used in such a way. For example, a person pretending to have a sad face might not be sad emotionally.

                • Type (string) --

                  Type of emotion detected.

                • Confidence (float) --

                  Level of confidence in the determination.

            • Landmarks (list) --

              Indicates the location of landmarks on the face. Default attribute.

              • (dict) --

                Indicates the location of the landmark on the face.

                • Type (string) --

                  Type of landmark.

                • X (float) --

                  The x-coordinate of the landmark expressed as a ratio of the width of the image. The x-coordinate is measured from the left-side of the image. For example, if the image is 700 pixels wide and the x-coordinate of the landmark is at 350 pixels, this value is 0.5.

                • Y (float) --

                  The y-coordinate of the landmark expressed as a ratio of the height of the image. The y-coordinate is measured from the top of the image. For example, if the image height is 200 pixels and the y-coordinate of the landmark is at 50 pixels, this value is 0.25.

            • Pose (dict) --

              Indicates the pose of the face as determined by its pitch, roll, and yaw. Default attribute.

              • Roll (float) --

                Value representing the face rotation on the roll axis.

              • Yaw (float) --

                Value representing the face rotation on the yaw axis.

              • Pitch (float) --

                Value representing the face rotation on the pitch axis.

            • Quality (dict) --

              Identifies image brightness and sharpness. Default attribute.

              • Brightness (float) --

                Value representing brightness of the face. The service returns a value between 0 and 100 (inclusive). A higher value indicates a brighter face image.

              • Sharpness (float) --

                Value representing sharpness of the face. The service returns a value between 0 and 100 (inclusive). A higher value indicates a sharper face image.

            • Confidence (float) --

              Confidence level that the bounding box contains a face (and not a different object such as a tree). Default attribute.

GetContentModeration (updated) Link ¶
Changes (response)
{'VideoMetadata': {'ColorRange': 'FULL | LIMITED'}}

Gets the inappropriate, unwanted, or offensive content analysis results for a Amazon Rekognition Video analysis started by StartContentModeration. For a list of moderation labels in Amazon Rekognition, see Using the image and video moderation APIs.

Amazon Rekognition Video inappropriate or offensive content detection in a stored video is an asynchronous operation. You start analysis by calling StartContentModeration which returns a job identifier ( JobId ). When analysis finishes, Amazon Rekognition Video publishes a completion status to the Amazon Simple Notification Service topic registered in the initial call to StartContentModeration . To get the results of the content analysis, first check that the status value published to the Amazon SNS topic is SUCCEEDED . If so, call GetContentModeration and pass the job identifier ( JobId ) from the initial call to StartContentModeration .

For more information, see Working with Stored Videos in the Amazon Rekognition Devlopers Guide.

GetContentModeration returns detected inappropriate, unwanted, or offensive content moderation labels, and the time they are detected, in an array, ModerationLabels , of ContentModerationDetection objects.

By default, the moderated labels are returned sorted by time, in milliseconds from the start of the video. You can also sort them by moderated label by specifying NAME for the SortBy input parameter.

Since video analysis can return a large number of results, use the MaxResults parameter to limit the number of labels returned in a single call to GetContentModeration . If there are more results than specified in MaxResults , the value of NextToken in the operation response contains a pagination token for getting the next set of results. To get the next page of results, call GetContentModeration and populate the NextToken request parameter with the value of NextToken returned from the previous call to GetContentModeration .

For more information, see Content moderation in the Amazon Rekognition Developer Guide.

See also: AWS API Documentation

Request Syntax

client.get_content_moderation(
    JobId='string',
    MaxResults=123,
    NextToken='string',
    SortBy='NAME'|'TIMESTAMP'
)
type JobId

string

param JobId

[REQUIRED]

The identifier for the inappropriate, unwanted, or offensive content moderation job. Use JobId to identify the job in a subsequent call to GetContentModeration .

type MaxResults

integer

param MaxResults

Maximum number of results to return per paginated call. The largest value you can specify is 1000. If you specify a value greater than 1000, a maximum of 1000 results is returned. The default value is 1000.

type NextToken

string

param NextToken

If the previous response was incomplete (because there is more data to retrieve), Amazon Rekognition returns a pagination token in the response. You can use this pagination token to retrieve the next set of content moderation labels.

type SortBy

string

param SortBy

Sort to use for elements in the ModerationLabelDetections array. Use TIMESTAMP to sort array elements by the time labels are detected. Use NAME to alphabetically group elements for a label together. Within each label group, the array element are sorted by detection confidence. The default sort is by TIMESTAMP .

rtype

dict

returns

Response Syntax

{
    'JobStatus': 'IN_PROGRESS'|'SUCCEEDED'|'FAILED',
    'StatusMessage': 'string',
    'VideoMetadata': {
        'Codec': 'string',
        'DurationMillis': 123,
        'Format': 'string',
        'FrameRate': ...,
        'FrameHeight': 123,
        'FrameWidth': 123,
        'ColorRange': 'FULL'|'LIMITED'
    },
    'ModerationLabels': [
        {
            'Timestamp': 123,
            'ModerationLabel': {
                'Confidence': ...,
                'Name': 'string',
                'ParentName': 'string'
            }
        },
    ],
    'NextToken': 'string',
    'ModerationModelVersion': 'string'
}

Response Structure

  • (dict) --

    • JobStatus (string) --

      The current status of the content moderation analysis job.

    • StatusMessage (string) --

      If the job fails, StatusMessage provides a descriptive error message.

    • VideoMetadata (dict) --

      Information about a video that Amazon Rekognition analyzed. Videometadata is returned in every page of paginated responses from GetContentModeration .

      • Codec (string) --

        Type of compression used in the analyzed video.

      • DurationMillis (integer) --

        Length of the video in milliseconds.

      • Format (string) --

        Format of the analyzed video. Possible values are MP4, MOV and AVI.

      • FrameRate (float) --

        Number of frames per second in the video.

      • FrameHeight (integer) --

        Vertical pixel dimension of the video.

      • FrameWidth (integer) --

        Horizontal pixel dimension of the video.

      • ColorRange (string) --

        A description of the range of luminance values in a video, either LIMITED (16 to 235) or FULL (0 to 255).

    • ModerationLabels (list) --

      The detected inappropriate, unwanted, or offensive content moderation labels and the time(s) they were detected.

      • (dict) --

        Information about an inappropriate, unwanted, or offensive content label detection in a stored video.

        • Timestamp (integer) --

          Time, in milliseconds from the beginning of the video, that the content moderation label was detected.

        • ModerationLabel (dict) --

          The content moderation label detected by in the stored video.

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

    • 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 content moderation labels.

    • ModerationModelVersion (string) --

      Version number of the moderation detection model that was used to detect inappropriate, unwanted, or offensive content.

GetFaceDetection (updated) Link ¶
Changes (response)
{'VideoMetadata': {'ColorRange': 'FULL | LIMITED'}}

Gets face detection results for a Amazon Rekognition Video analysis started by StartFaceDetection.

Face detection with Amazon Rekognition Video is an asynchronous operation. You start face detection by calling StartFaceDetection which returns a job identifier ( JobId ). When the face detection operation finishes, Amazon Rekognition Video publishes a completion status to the Amazon Simple Notification Service topic registered in the initial call to StartFaceDetection . To get the results of the face detection operation, first check that the status value published to the Amazon SNS topic is SUCCEEDED . If so, call GetFaceDetection and pass the job identifier ( JobId ) from the initial call to StartFaceDetection .

GetFaceDetection returns an array of detected faces ( Faces ) sorted by the time the faces were detected.

Use MaxResults parameter to limit the number of labels returned. If there are more results than specified in MaxResults , the value of NextToken in the operation response contains a pagination token for getting the next set of results. To get the next page of results, call GetFaceDetection and populate the NextToken request parameter with the token value returned from the previous call to GetFaceDetection .

See also: AWS API Documentation

Request Syntax

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

string

param JobId

[REQUIRED]

Unique identifier for the face detection job. The JobId is returned from StartFaceDetection .

type MaxResults

integer

param MaxResults

Maximum number of results to return per paginated call. The largest value you can specify is 1000. If you specify a value greater than 1000, a maximum of 1000 results is returned. The default value is 1000.

type NextToken

string

param NextToken

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

rtype

dict

returns

Response Syntax

{
    'JobStatus': 'IN_PROGRESS'|'SUCCEEDED'|'FAILED',
    'StatusMessage': 'string',
    'VideoMetadata': {
        'Codec': 'string',
        'DurationMillis': 123,
        'Format': 'string',
        'FrameRate': ...,
        'FrameHeight': 123,
        'FrameWidth': 123,
        'ColorRange': 'FULL'|'LIMITED'
    },
    'NextToken': 'string',
    'Faces': [
        {
            'Timestamp': 123,
            'Face': {
                'BoundingBox': {
                    'Width': ...,
                    'Height': ...,
                    'Left': ...,
                    'Top': ...
                },
                'AgeRange': {
                    'Low': 123,
                    'High': 123
                },
                'Smile': {
                    'Value': True|False,
                    'Confidence': ...
                },
                'Eyeglasses': {
                    'Value': True|False,
                    'Confidence': ...
                },
                'Sunglasses': {
                    'Value': True|False,
                    'Confidence': ...
                },
                'Gender': {
                    'Value': 'Male'|'Female',
                    'Confidence': ...
                },
                'Beard': {
                    'Value': True|False,
                    'Confidence': ...
                },
                'Mustache': {
                    'Value': True|False,
                    'Confidence': ...
                },
                'EyesOpen': {
                    'Value': True|False,
                    'Confidence': ...
                },
                'MouthOpen': {
                    'Value': True|False,
                    'Confidence': ...
                },
                'Emotions': [
                    {
                        'Type': 'HAPPY'|'SAD'|'ANGRY'|'CONFUSED'|'DISGUSTED'|'SURPRISED'|'CALM'|'UNKNOWN'|'FEAR',
                        'Confidence': ...
                    },
                ],
                'Landmarks': [
                    {
                        'Type': 'eyeLeft'|'eyeRight'|'nose'|'mouthLeft'|'mouthRight'|'leftEyeBrowLeft'|'leftEyeBrowRight'|'leftEyeBrowUp'|'rightEyeBrowLeft'|'rightEyeBrowRight'|'rightEyeBrowUp'|'leftEyeLeft'|'leftEyeRight'|'leftEyeUp'|'leftEyeDown'|'rightEyeLeft'|'rightEyeRight'|'rightEyeUp'|'rightEyeDown'|'noseLeft'|'noseRight'|'mouthUp'|'mouthDown'|'leftPupil'|'rightPupil'|'upperJawlineLeft'|'midJawlineLeft'|'chinBottom'|'midJawlineRight'|'upperJawlineRight',
                        'X': ...,
                        'Y': ...
                    },
                ],
                'Pose': {
                    'Roll': ...,
                    'Yaw': ...,
                    'Pitch': ...
                },
                'Quality': {
                    'Brightness': ...,
                    'Sharpness': ...
                },
                'Confidence': ...
            }
        },
    ]
}

Response Structure

  • (dict) --

    • JobStatus (string) --

      The current status of the face detection job.

    • StatusMessage (string) --

      If the job fails, StatusMessage provides a descriptive error message.

    • VideoMetadata (dict) --

      Information about a video that Amazon Rekognition Video analyzed. Videometadata is returned in every page of paginated responses from a Amazon Rekognition video operation.

      • Codec (string) --

        Type of compression used in the analyzed video.

      • DurationMillis (integer) --

        Length of the video in milliseconds.

      • Format (string) --

        Format of the analyzed video. Possible values are MP4, MOV and AVI.

      • FrameRate (float) --

        Number of frames per second in the video.

      • FrameHeight (integer) --

        Vertical pixel dimension of the video.

      • FrameWidth (integer) --

        Horizontal pixel dimension of the video.

      • ColorRange (string) --

        A description of the range of luminance values in a video, either LIMITED (16 to 235) or FULL (0 to 255).

    • NextToken (string) --

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

    • Faces (list) --

      An array of faces detected in the video. Each element contains a detected face's details and the time, in milliseconds from the start of the video, the face was detected.

      • (dict) --

        Information about a face detected in a video analysis request and the time the face was detected in the video.

        • Timestamp (integer) --

          Time, in milliseconds from the start of the video, that the face was detected.

        • Face (dict) --

          The face properties for the detected face.

          • BoundingBox (dict) --

            Bounding box of the face. Default attribute.

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

          • AgeRange (dict) --

            The estimated age range, in years, for the face. Low represents the lowest estimated age and High represents the highest estimated age.

            • Low (integer) --

              The lowest estimated age.

            • High (integer) --

              The highest estimated age.

          • Smile (dict) --

            Indicates whether or not the face is smiling, and the confidence level in the determination.

            • Value (boolean) --

              Boolean value that indicates whether the face is smiling or not.

            • Confidence (float) --

              Level of confidence in the determination.

          • Eyeglasses (dict) --

            Indicates whether or not the face is wearing eye glasses, and the confidence level in the determination.

            • Value (boolean) --

              Boolean value that indicates whether the face is wearing eye glasses or not.

            • Confidence (float) --

              Level of confidence in the determination.

          • Sunglasses (dict) --

            Indicates whether or not the face is wearing sunglasses, and the confidence level in the determination.

            • Value (boolean) --

              Boolean value that indicates whether the face is wearing sunglasses or not.

            • Confidence (float) --

              Level of confidence in the determination.

          • Gender (dict) --

            The predicted gender of a detected face.

            • Value (string) --

              The predicted gender of the face.

            • Confidence (float) --

              Level of confidence in the prediction.

          • Beard (dict) --

            Indicates whether or not the face has a beard, and the confidence level in the determination.

            • Value (boolean) --

              Boolean value that indicates whether the face has beard or not.

            • Confidence (float) --

              Level of confidence in the determination.

          • Mustache (dict) --

            Indicates whether or not the face has a mustache, and the confidence level in the determination.

            • Value (boolean) --

              Boolean value that indicates whether the face has mustache or not.

            • Confidence (float) --

              Level of confidence in the determination.

          • EyesOpen (dict) --

            Indicates whether or not the eyes on the face are open, and the confidence level in the determination.

            • Value (boolean) --

              Boolean value that indicates whether the eyes on the face are open.

            • Confidence (float) --

              Level of confidence in the determination.

          • MouthOpen (dict) --

            Indicates whether or not the mouth on the face is open, and the confidence level in the determination.

            • Value (boolean) --

              Boolean value that indicates whether the mouth on the face is open or not.

            • Confidence (float) --

              Level of confidence in the determination.

          • Emotions (list) --

            The emotions that appear to be expressed on the face, and the confidence level in the determination. The API is only making a determination of the physical appearance of a person's face. It is not a determination of the person’s internal emotional state and should not be used in such a way. For example, a person pretending to have a sad face might not be sad emotionally.

            • (dict) --

              The emotions that appear to be expressed on the face, and the confidence level in the determination. The API is only making a determination of the physical appearance of a person's face. It is not a determination of the person’s internal emotional state and should not be used in such a way. For example, a person pretending to have a sad face might not be sad emotionally.

              • Type (string) --

                Type of emotion detected.

              • Confidence (float) --

                Level of confidence in the determination.

          • Landmarks (list) --

            Indicates the location of landmarks on the face. Default attribute.

            • (dict) --

              Indicates the location of the landmark on the face.

              • Type (string) --

                Type of landmark.

              • X (float) --

                The x-coordinate of the landmark expressed as a ratio of the width of the image. The x-coordinate is measured from the left-side of the image. For example, if the image is 700 pixels wide and the x-coordinate of the landmark is at 350 pixels, this value is 0.5.

              • Y (float) --

                The y-coordinate of the landmark expressed as a ratio of the height of the image. The y-coordinate is measured from the top of the image. For example, if the image height is 200 pixels and the y-coordinate of the landmark is at 50 pixels, this value is 0.25.

          • Pose (dict) --

            Indicates the pose of the face as determined by its pitch, roll, and yaw. Default attribute.

            • Roll (float) --

              Value representing the face rotation on the roll axis.

            • Yaw (float) --

              Value representing the face rotation on the yaw axis.

            • Pitch (float) --

              Value representing the face rotation on the pitch axis.

          • Quality (dict) --

            Identifies image brightness and sharpness. Default attribute.

            • Brightness (float) --

              Value representing brightness of the face. The service returns a value between 0 and 100 (inclusive). A higher value indicates a brighter face image.

            • Sharpness (float) --

              Value representing sharpness of the face. The service returns a value between 0 and 100 (inclusive). A higher value indicates a sharper face image.

          • Confidence (float) --

            Confidence level that the bounding box contains a face (and not a different object such as a tree). Default attribute.

GetFaceSearch (updated) Link ¶
Changes (response)
{'VideoMetadata': {'ColorRange': 'FULL | LIMITED'}}

Gets the face search results for Amazon Rekognition Video face search started by StartFaceSearch. The search returns faces in a collection that match the faces of persons detected in a video. It also includes the time(s) that faces are matched in the video.

Face search in a video is an asynchronous operation. You start face search by calling to StartFaceSearch which returns a job identifier ( JobId ). When the search operation finishes, Amazon Rekognition Video publishes a completion status to the Amazon Simple Notification Service topic registered in the initial call to StartFaceSearch . To get the search results, first check that the status value published to the Amazon SNS topic is SUCCEEDED . If so, call GetFaceSearch and pass the job identifier ( JobId ) from the initial call to StartFaceSearch .

For more information, see Searching Faces in a Collection in the Amazon Rekognition Developer Guide.

The search results are retured in an array, Persons , of PersonMatch objects. Each PersonMatch element contains details about the matching faces in the input collection, person information (facial attributes, bounding boxes, and person identifer) for the matched person, and the time the person was matched in the video.

Note

GetFaceSearch only returns the default facial attributes ( BoundingBox , Confidence , Landmarks , Pose , and Quality ). The other facial attributes listed in the Face object of the following response syntax are not returned. For more information, see FaceDetail in the Amazon Rekognition Developer Guide.

By default, the Persons array is sorted by the time, in milliseconds from the start of the video, persons are matched. You can also sort by persons by specifying INDEX for the SORTBY input parameter.

See also: AWS API Documentation

Request Syntax

client.get_face_search(
    JobId='string',
    MaxResults=123,
    NextToken='string',
    SortBy='INDEX'|'TIMESTAMP'
)
type JobId

string

param JobId

[REQUIRED]

The job identifer for the search request. You get the job identifier from an initial call to StartFaceSearch .

type MaxResults

integer

param MaxResults

Maximum number of results to return per paginated call. The largest value you can specify is 1000. If you specify a value greater than 1000, a maximum of 1000 results is returned. The default value is 1000.

type NextToken

string

param NextToken

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

type SortBy

string

param SortBy

Sort to use for grouping faces in the response. Use TIMESTAMP to group faces by the time that they are recognized. Use INDEX to sort by recognized faces.

rtype

dict

returns

Response Syntax

{
    'JobStatus': 'IN_PROGRESS'|'SUCCEEDED'|'FAILED',
    'StatusMessage': 'string',
    'NextToken': 'string',
    'VideoMetadata': {
        'Codec': 'string',
        'DurationMillis': 123,
        'Format': 'string',
        'FrameRate': ...,
        'FrameHeight': 123,
        'FrameWidth': 123,
        'ColorRange': 'FULL'|'LIMITED'
    },
    'Persons': [
        {
            'Timestamp': 123,
            'Person': {
                'Index': 123,
                'BoundingBox': {
                    'Width': ...,
                    'Height': ...,
                    'Left': ...,
                    'Top': ...
                },
                'Face': {
                    'BoundingBox': {
                        'Width': ...,
                        'Height': ...,
                        'Left': ...,
                        'Top': ...
                    },
                    'AgeRange': {
                        'Low': 123,
                        'High': 123
                    },
                    'Smile': {
                        'Value': True|False,
                        'Confidence': ...
                    },
                    'Eyeglasses': {
                        'Value': True|False,
                        'Confidence': ...
                    },
                    'Sunglasses': {
                        'Value': True|False,
                        'Confidence': ...
                    },
                    'Gender': {
                        'Value': 'Male'|'Female',
                        'Confidence': ...
                    },
                    'Beard': {
                        'Value': True|False,
                        'Confidence': ...
                    },
                    'Mustache': {
                        'Value': True|False,
                        'Confidence': ...
                    },
                    'EyesOpen': {
                        'Value': True|False,
                        'Confidence': ...
                    },
                    'MouthOpen': {
                        'Value': True|False,
                        'Confidence': ...
                    },
                    'Emotions': [
                        {
                            'Type': 'HAPPY'|'SAD'|'ANGRY'|'CONFUSED'|'DISGUSTED'|'SURPRISED'|'CALM'|'UNKNOWN'|'FEAR',
                            'Confidence': ...
                        },
                    ],
                    'Landmarks': [
                        {
                            'Type': 'eyeLeft'|'eyeRight'|'nose'|'mouthLeft'|'mouthRight'|'leftEyeBrowLeft'|'leftEyeBrowRight'|'leftEyeBrowUp'|'rightEyeBrowLeft'|'rightEyeBrowRight'|'rightEyeBrowUp'|'leftEyeLeft'|'leftEyeRight'|'leftEyeUp'|'leftEyeDown'|'rightEyeLeft'|'rightEyeRight'|'rightEyeUp'|'rightEyeDown'|'noseLeft'|'noseRight'|'mouthUp'|'mouthDown'|'leftPupil'|'rightPupil'|'upperJawlineLeft'|'midJawlineLeft'|'chinBottom'|'midJawlineRight'|'upperJawlineRight',
                            'X': ...,
                            'Y': ...
                        },
                    ],
                    'Pose': {
                        'Roll': ...,
                        'Yaw': ...,
                        'Pitch': ...
                    },
                    'Quality': {
                        'Brightness': ...,
                        'Sharpness': ...
                    },
                    'Confidence': ...
                }
            },
            'FaceMatches': [
                {
                    'Similarity': ...,
                    'Face': {
                        'FaceId': 'string',
                        'BoundingBox': {
                            'Width': ...,
                            'Height': ...,
                            'Left': ...,
                            'Top': ...
                        },
                        'ImageId': 'string',
                        'ExternalImageId': 'string',
                        'Confidence': ...
                    }
                },
            ]
        },
    ]
}

Response Structure

  • (dict) --

    • JobStatus (string) --

      The current status of the face search job.

    • StatusMessage (string) --

      If the job fails, StatusMessage provides a descriptive error message.

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

    • VideoMetadata (dict) --

      Information about a video that Amazon Rekognition analyzed. Videometadata is returned in every page of paginated responses from a Amazon Rekognition Video operation.

      • Codec (string) --

        Type of compression used in the analyzed video.

      • DurationMillis (integer) --

        Length of the video in milliseconds.

      • Format (string) --

        Format of the analyzed video. Possible values are MP4, MOV and AVI.

      • FrameRate (float) --

        Number of frames per second in the video.

      • FrameHeight (integer) --

        Vertical pixel dimension of the video.

      • FrameWidth (integer) --

        Horizontal pixel dimension of the video.

      • ColorRange (string) --

        A description of the range of luminance values in a video, either LIMITED (16 to 235) or FULL (0 to 255).

    • Persons (list) --

      An array of persons, PersonMatch, in the video whose face(s) match the face(s) in an Amazon Rekognition collection. It also includes time information for when persons are matched in the video. You specify the input collection in an initial call to StartFaceSearch . Each Persons element includes a time the person was matched, face match details ( FaceMatches ) for matching faces in the collection, and person information ( Person ) for the matched person.

      • (dict) --

        Information about a person whose face matches a face(s) in an Amazon Rekognition collection. Includes information about the faces in the Amazon Rekognition collection ( FaceMatch ), information about the person ( PersonDetail ), and the time stamp for when the person was detected in a video. An array of PersonMatch objects is returned by GetFaceSearch.

        • Timestamp (integer) --

          The time, in milliseconds from the beginning of the video, that the person was matched in the video.

        • Person (dict) --

          Information about the matched person.

          • Index (integer) --

            Identifier for the person detected person within a video. Use to keep track of the person throughout the video. The identifier is not stored by Amazon Rekognition.

          • BoundingBox (dict) --

            Bounding box around the detected person.

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

          • Face (dict) --

            Face details for the detected person.

            • BoundingBox (dict) --

              Bounding box of the face. Default attribute.

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

            • AgeRange (dict) --

              The estimated age range, in years, for the face. Low represents the lowest estimated age and High represents the highest estimated age.

              • Low (integer) --

                The lowest estimated age.

              • High (integer) --

                The highest estimated age.

            • Smile (dict) --

              Indicates whether or not the face is smiling, and the confidence level in the determination.

              • Value (boolean) --

                Boolean value that indicates whether the face is smiling or not.

              • Confidence (float) --

                Level of confidence in the determination.

            • Eyeglasses (dict) --

              Indicates whether or not the face is wearing eye glasses, and the confidence level in the determination.

              • Value (boolean) --

                Boolean value that indicates whether the face is wearing eye glasses or not.

              • Confidence (float) --

                Level of confidence in the determination.

            • Sunglasses (dict) --

              Indicates whether or not the face is wearing sunglasses, and the confidence level in the determination.

              • Value (boolean) --

                Boolean value that indicates whether the face is wearing sunglasses or not.

              • Confidence (float) --

                Level of confidence in the determination.

            • Gender (dict) --

              The predicted gender of a detected face.

              • Value (string) --

                The predicted gender of the face.

              • Confidence (float) --

                Level of confidence in the prediction.

            • Beard (dict) --

              Indicates whether or not the face has a beard, and the confidence level in the determination.

              • Value (boolean) --

                Boolean value that indicates whether the face has beard or not.

              • Confidence (float) --

                Level of confidence in the determination.

            • Mustache (dict) --

              Indicates whether or not the face has a mustache, and the confidence level in the determination.

              • Value (boolean) --

                Boolean value that indicates whether the face has mustache or not.

              • Confidence (float) --

                Level of confidence in the determination.

            • EyesOpen (dict) --

              Indicates whether or not the eyes on the face are open, and the confidence level in the determination.

              • Value (boolean) --

                Boolean value that indicates whether the eyes on the face are open.

              • Confidence (float) --

                Level of confidence in the determination.

            • MouthOpen (dict) --

              Indicates whether or not the mouth on the face is open, and the confidence level in the determination.

              • Value (boolean) --

                Boolean value that indicates whether the mouth on the face is open or not.

              • Confidence (float) --

                Level of confidence in the determination.

            • Emotions (list) --

              The emotions that appear to be expressed on the face, and the confidence level in the determination. The API is only making a determination of the physical appearance of a person's face. It is not a determination of the person’s internal emotional state and should not be used in such a way. For example, a person pretending to have a sad face might not be sad emotionally.

              • (dict) --

                The emotions that appear to be expressed on the face, and the confidence level in the determination. The API is only making a determination of the physical appearance of a person's face. It is not a determination of the person’s internal emotional state and should not be used in such a way. For example, a person pretending to have a sad face might not be sad emotionally.

                • Type (string) --

                  Type of emotion detected.

                • Confidence (float) --

                  Level of confidence in the determination.

            • Landmarks (list) --

              Indicates the location of landmarks on the face. Default attribute.

              • (dict) --

                Indicates the location of the landmark on the face.

                • Type (string) --

                  Type of landmark.

                • X (float) --

                  The x-coordinate of the landmark expressed as a ratio of the width of the image. The x-coordinate is measured from the left-side of the image. For example, if the image is 700 pixels wide and the x-coordinate of the landmark is at 350 pixels, this value is 0.5.

                • Y (float) --

                  The y-coordinate of the landmark expressed as a ratio of the height of the image. The y-coordinate is measured from the top of the image. For example, if the image height is 200 pixels and the y-coordinate of the landmark is at 50 pixels, this value is 0.25.

            • Pose (dict) --

              Indicates the pose of the face as determined by its pitch, roll, and yaw. Default attribute.

              • Roll (float) --

                Value representing the face rotation on the roll axis.

              • Yaw (float) --

                Value representing the face rotation on the yaw axis.

              • Pitch (float) --

                Value representing the face rotation on the pitch axis.

            • Quality (dict) --

              Identifies image brightness and sharpness. Default attribute.

              • Brightness (float) --

                Value representing brightness of the face. The service returns a value between 0 and 100 (inclusive). A higher value indicates a brighter face image.

              • Sharpness (float) --

                Value representing sharpness of the face. The service returns a value between 0 and 100 (inclusive). A higher value indicates a sharper face image.

            • Confidence (float) --

              Confidence level that the bounding box contains a face (and not a different object such as a tree). Default attribute.

        • FaceMatches (list) --

          Information about the faces in the input collection that match the face of a person in the video.

          • (dict) --

            Provides face metadata. In addition, it also provides the confidence in the match of this face with the input face.

            • Similarity (float) --

              Confidence in the match of this face with the input face.

            • Face (dict) --

              Describes the face properties such as the bounding box, face ID, image ID of the source image, and external image ID that you assigned.

              • FaceId (string) --

                Unique identifier that Amazon Rekognition assigns to the face.

              • BoundingBox (dict) --

                Bounding box of the face.

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

              • ImageId (string) --

                Unique identifier that Amazon Rekognition assigns to the input image.

              • ExternalImageId (string) --

                Identifier that you assign to all the faces in the input image.

              • Confidence (float) --

                Confidence level that the bounding box contains a face (and not a different object such as a tree).

GetLabelDetection (updated) Link ¶
Changes (response)
{'VideoMetadata': {'ColorRange': 'FULL | LIMITED'}}

Gets the label detection results of a Amazon Rekognition Video analysis started by StartLabelDetection.

The label detection operation is started by a call to StartLabelDetection which returns a job identifier ( JobId ). When the label detection operation finishes, Amazon Rekognition publishes a completion status to the Amazon Simple Notification Service topic registered in the initial call to StartlabelDetection . To get the results of the label detection operation, first check that the status value published to the Amazon SNS topic is SUCCEEDED . If so, call GetLabelDetection and pass the job identifier ( JobId ) from the initial call to StartLabelDetection .

GetLabelDetection returns an array of detected labels ( Labels ) sorted by the time the labels were detected. You can also sort by the label name by specifying NAME for the SortBy input parameter.

The labels returned include the label name, the percentage confidence in the accuracy of the detected label, and the time the label was detected in the video.

The returned labels also include bounding box information for common objects, a hierarchical taxonomy of detected labels, and the version of the label model used for detection.

Use MaxResults parameter to limit the number of labels returned. If there are more results than specified in MaxResults , the value of NextToken in the operation response contains a pagination token for getting the next set of results. To get the next page of results, call GetlabelDetection and populate the NextToken request parameter with the token value returned from the previous call to GetLabelDetection .

See also: AWS API Documentation

Request Syntax

client.get_label_detection(
    JobId='string',
    MaxResults=123,
    NextToken='string',
    SortBy='NAME'|'TIMESTAMP'
)
type JobId

string

param JobId

[REQUIRED]

Job identifier for the label detection operation for which you want results returned. You get the job identifer from an initial call to StartlabelDetection .

type MaxResults

integer

param MaxResults

Maximum number of results to return per paginated call. The largest value you can specify is 1000. If you specify a value greater than 1000, a maximum of 1000 results is returned. The default value is 1000.

type NextToken

string

param NextToken

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

type SortBy

string

param SortBy

Sort to use for elements in the Labels array. Use TIMESTAMP to sort array elements by the time labels are detected. Use NAME to alphabetically group elements for a label together. Within each label group, the array element are sorted by detection confidence. The default sort is by TIMESTAMP .

rtype

dict

returns

Response Syntax

{
    'JobStatus': 'IN_PROGRESS'|'SUCCEEDED'|'FAILED',
    'StatusMessage': 'string',
    'VideoMetadata': {
        'Codec': 'string',
        'DurationMillis': 123,
        'Format': 'string',
        'FrameRate': ...,
        'FrameHeight': 123,
        'FrameWidth': 123,
        'ColorRange': 'FULL'|'LIMITED'
    },
    'NextToken': 'string',
    'Labels': [
        {
            'Timestamp': 123,
            'Label': {
                'Name': 'string',
                'Confidence': ...,
                'Instances': [
                    {
                        'BoundingBox': {
                            'Width': ...,
                            'Height': ...,
                            'Left': ...,
                            'Top': ...
                        },
                        'Confidence': ...
                    },
                ],
                'Parents': [
                    {
                        'Name': 'string'
                    },
                ]
            }
        },
    ],
    'LabelModelVersion': 'string'
}

Response Structure

  • (dict) --

    • JobStatus (string) --

      The current status of the label detection job.

    • StatusMessage (string) --

      If the job fails, StatusMessage provides a descriptive error message.

    • VideoMetadata (dict) --

      Information about a video that Amazon Rekognition Video analyzed. Videometadata is returned in every page of paginated responses from a Amazon Rekognition video operation.

      • Codec (string) --

        Type of compression used in the analyzed video.

      • DurationMillis (integer) --

        Length of the video in milliseconds.

      • Format (string) --

        Format of the analyzed video. Possible values are MP4, MOV and AVI.

      • FrameRate (float) --

        Number of frames per second in the video.

      • FrameHeight (integer) --

        Vertical pixel dimension of the video.

      • FrameWidth (integer) --

        Horizontal pixel dimension of the video.

      • ColorRange (string) --

        A description of the range of luminance values in a video, either LIMITED (16 to 235) or FULL (0 to 255).

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

    • Labels (list) --

      An array of labels detected in the video. Each element contains the detected label and the time, in milliseconds from the start of the video, that the label was detected.

      • (dict) --

        Information about a label detected in a video analysis request and the time the label was detected in the video.

        • Timestamp (integer) --

          Time, in milliseconds from the start of the video, that the label was detected.

        • Label (dict) --

          Details about the detected label.

          • Name (string) --

            The name (label) of the object or scene.

          • Confidence (float) --

            Level of confidence.

          • Instances (list) --

            If Label represents an object, Instances contains the bounding boxes for each instance of the detected object. Bounding boxes are returned for common object labels such as people, cars, furniture, apparel or pets.

            • (dict) --

              An instance of a label returned by Amazon Rekognition Image ( DetectLabels ) or by Amazon Rekognition Video ( GetLabelDetection ).

              • BoundingBox (dict) --

                The position of the label instance 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.

              • Confidence (float) --

                The confidence that Amazon Rekognition has in the accuracy of the bounding box.

          • Parents (list) --

            The parent labels for a label. The response includes all ancestor labels.

            • (dict) --

              A parent label for a label. A label can have 0, 1, or more parents.

              • Name (string) --

                The name of the parent label.

    • LabelModelVersion (string) --

      Version number of the label detection model that was used to detect labels.

GetPersonTracking (updated) Link ¶
Changes (response)
{'VideoMetadata': {'ColorRange': 'FULL | LIMITED'}}

Gets the path tracking results of a Amazon Rekognition Video analysis started by StartPersonTracking.

The person path tracking operation is started by a call to StartPersonTracking which returns a job identifier ( JobId ). When the operation finishes, Amazon Rekognition Video publishes a completion status to the Amazon Simple Notification Service topic registered in the initial call to StartPersonTracking .

To get the results of the person path tracking operation, first check that the status value published to the Amazon SNS topic is SUCCEEDED . If so, call GetPersonTracking and pass the job identifier ( JobId ) from the initial call to StartPersonTracking .

GetPersonTracking returns an array, Persons , of tracked persons and the time(s) their paths were tracked in the video.

Note

GetPersonTracking only returns the default facial attributes ( BoundingBox , Confidence , Landmarks , Pose , and Quality ). The other facial attributes listed in the Face object of the following response syntax are not returned.

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

By default, the array is sorted by the time(s) a person's path is tracked in the video. You can sort by tracked persons by specifying INDEX for the SortBy input parameter.

Use the MaxResults parameter to limit the number of items returned. If there are more results than specified in MaxResults , the value of NextToken in the operation response contains a pagination token for getting the next set of results. To get the next page of results, call GetPersonTracking and populate the NextToken request parameter with the token value returned from the previous call to GetPersonTracking .

See also: AWS API Documentation

Request Syntax

client.get_person_tracking(
    JobId='string',
    MaxResults=123,
    NextToken='string',
    SortBy='INDEX'|'TIMESTAMP'
)
type JobId

string

param JobId

[REQUIRED]

The identifier for a job that tracks persons in a video. You get the JobId from a call to StartPersonTracking .

type MaxResults

integer

param MaxResults

Maximum number of results to return per paginated call. The largest value you can specify is 1000. If you specify a value greater than 1000, a maximum of 1000 results is returned. The default value is 1000.

type NextToken

string

param NextToken

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

type SortBy

string

param SortBy

Sort to use for elements in the Persons array. Use TIMESTAMP to sort array elements by the time persons are detected. Use INDEX to sort by the tracked persons. If you sort by INDEX , the array elements for each person are sorted by detection confidence. The default sort is by TIMESTAMP .

rtype

dict

returns

Response Syntax

{
    'JobStatus': 'IN_PROGRESS'|'SUCCEEDED'|'FAILED',
    'StatusMessage': 'string',
    'VideoMetadata': {
        'Codec': 'string',
        'DurationMillis': 123,
        'Format': 'string',
        'FrameRate': ...,
        'FrameHeight': 123,
        'FrameWidth': 123,
        'ColorRange': 'FULL'|'LIMITED'
    },
    'NextToken': 'string',
    'Persons': [
        {
            'Timestamp': 123,
            'Person': {
                'Index': 123,
                'BoundingBox': {
                    'Width': ...,
                    'Height': ...,
                    'Left': ...,
                    'Top': ...
                },
                'Face': {
                    'BoundingBox': {
                        'Width': ...,
                        'Height': ...,
                        'Left': ...,
                        'Top': ...
                    },
                    'AgeRange': {
                        'Low': 123,
                        'High': 123
                    },
                    'Smile': {
                        'Value': True|False,
                        'Confidence': ...
                    },
                    'Eyeglasses': {
                        'Value': True|False,
                        'Confidence': ...
                    },
                    'Sunglasses': {
                        'Value': True|False,
                        'Confidence': ...
                    },
                    'Gender': {
                        'Value': 'Male'|'Female',
                        'Confidence': ...
                    },
                    'Beard': {
                        'Value': True|False,
                        'Confidence': ...
                    },
                    'Mustache': {
                        'Value': True|False,
                        'Confidence': ...
                    },
                    'EyesOpen': {
                        'Value': True|False,
                        'Confidence': ...
                    },
                    'MouthOpen': {
                        'Value': True|False,
                        'Confidence': ...
                    },
                    'Emotions': [
                        {
                            'Type': 'HAPPY'|'SAD'|'ANGRY'|'CONFUSED'|'DISGUSTED'|'SURPRISED'|'CALM'|'UNKNOWN'|'FEAR',
                            'Confidence': ...
                        },
                    ],
                    'Landmarks': [
                        {
                            'Type': 'eyeLeft'|'eyeRight'|'nose'|'mouthLeft'|'mouthRight'|'leftEyeBrowLeft'|'leftEyeBrowRight'|'leftEyeBrowUp'|'rightEyeBrowLeft'|'rightEyeBrowRight'|'rightEyeBrowUp'|'leftEyeLeft'|'leftEyeRight'|'leftEyeUp'|'leftEyeDown'|'rightEyeLeft'|'rightEyeRight'|'rightEyeUp'|'rightEyeDown'|'noseLeft'|'noseRight'|'mouthUp'|'mouthDown'|'leftPupil'|'rightPupil'|'upperJawlineLeft'|'midJawlineLeft'|'chinBottom'|'midJawlineRight'|'upperJawlineRight',
                            'X': ...,
                            'Y': ...
                        },
                    ],
                    'Pose': {
                        'Roll': ...,
                        'Yaw': ...,
                        'Pitch': ...
                    },
                    'Quality': {
                        'Brightness': ...,
                        'Sharpness': ...
                    },
                    'Confidence': ...
                }
            }
        },
    ]
}

Response Structure

  • (dict) --

    • JobStatus (string) --

      The current status of the person tracking job.

    • StatusMessage (string) --

      If the job fails, StatusMessage provides a descriptive error message.

    • VideoMetadata (dict) --

      Information about a video that Amazon Rekognition Video analyzed. Videometadata is returned in every page of paginated responses from a Amazon Rekognition Video operation.

      • Codec (string) --

        Type of compression used in the analyzed video.

      • DurationMillis (integer) --

        Length of the video in milliseconds.

      • Format (string) --

        Format of the analyzed video. Possible values are MP4, MOV and AVI.

      • FrameRate (float) --

        Number of frames per second in the video.

      • FrameHeight (integer) --

        Vertical pixel dimension of the video.

      • FrameWidth (integer) --

        Horizontal pixel dimension of the video.

      • ColorRange (string) --

        A description of the range of luminance values in a video, either LIMITED (16 to 235) or FULL (0 to 255).

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

    • Persons (list) --

      An array of the persons detected in the video and the time(s) their path was tracked throughout the video. An array element will exist for each time a person's path is tracked.

      • (dict) --

        Details and path tracking information for a single time a person's path is tracked in a video. Amazon Rekognition operations that track people's paths return an array of PersonDetection objects with elements for each time a person's path is tracked in a video.

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

        • Timestamp (integer) --

          The time, in milliseconds from the start of the video, that the person's path was tracked.

        • Person (dict) --

          Details about a person whose path was tracked in a video.

          • Index (integer) --

            Identifier for the person detected person within a video. Use to keep track of the person throughout the video. The identifier is not stored by Amazon Rekognition.

          • BoundingBox (dict) --

            Bounding box around the detected person.

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

          • Face (dict) --

            Face details for the detected person.

            • BoundingBox (dict) --

              Bounding box of the face. Default attribute.

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

            • AgeRange (dict) --

              The estimated age range, in years, for the face. Low represents the lowest estimated age and High represents the highest estimated age.

              • Low (integer) --

                The lowest estimated age.

              • High (integer) --

                The highest estimated age.

            • Smile (dict) --

              Indicates whether or not the face is smiling, and the confidence level in the determination.

              • Value (boolean) --

                Boolean value that indicates whether the face is smiling or not.

              • Confidence (float) --

                Level of confidence in the determination.

            • Eyeglasses (dict) --

              Indicates whether or not the face is wearing eye glasses, and the confidence level in the determination.

              • Value (boolean) --

                Boolean value that indicates whether the face is wearing eye glasses or not.

              • Confidence (float) --

                Level of confidence in the determination.

            • Sunglasses (dict) --

              Indicates whether or not the face is wearing sunglasses, and the confidence level in the determination.

              • Value (boolean) --

                Boolean value that indicates whether the face is wearing sunglasses or not.

              • Confidence (float) --

                Level of confidence in the determination.

            • Gender (dict) --

              The predicted gender of a detected face.

              • Value (string) --

                The predicted gender of the face.

              • Confidence (float) --

                Level of confidence in the prediction.

            • Beard (dict) --

              Indicates whether or not the face has a beard, and the confidence level in the determination.

              • Value (boolean) --

                Boolean value that indicates whether the face has beard or not.

              • Confidence (float) --

                Level of confidence in the determination.

            • Mustache (dict) --

              Indicates whether or not the face has a mustache, and the confidence level in the determination.

              • Value (boolean) --

                Boolean value that indicates whether the face has mustache or not.

              • Confidence (float) --

                Level of confidence in the determination.

            • EyesOpen (dict) --

              Indicates whether or not the eyes on the face are open, and the confidence level in the determination.

              • Value (boolean) --

                Boolean value that indicates whether the eyes on the face are open.

              • Confidence (float) --

                Level of confidence in the determination.

            • MouthOpen (dict) --

              Indicates whether or not the mouth on the face is open, and the confidence level in the determination.

              • Value (boolean) --

                Boolean value that indicates whether the mouth on the face is open or not.

              • Confidence (float) --

                Level of confidence in the determination.

            • Emotions (list) --

              The emotions that appear to be expressed on the face, and the confidence level in the determination. The API is only making a determination of the physical appearance of a person's face. It is not a determination of the person’s internal emotional state and should not be used in such a way. For example, a person pretending to have a sad face might not be sad emotionally.

              • (dict) --

                The emotions that appear to be expressed on the face, and the confidence level in the determination. The API is only making a determination of the physical appearance of a person's face. It is not a determination of the person’s internal emotional state and should not be used in such a way. For example, a person pretending to have a sad face might not be sad emotionally.

                • Type (string) --

                  Type of emotion detected.

                • Confidence (float) --

                  Level of confidence in the determination.

            • Landmarks (list) --

              Indicates the location of landmarks on the face. Default attribute.

              • (dict) --

                Indicates the location of the landmark on the face.

                • Type (string) --

                  Type of landmark.

                • X (float) --

                  The x-coordinate of the landmark expressed as a ratio of the width of the image. The x-coordinate is measured from the left-side of the image. For example, if the image is 700 pixels wide and the x-coordinate of the landmark is at 350 pixels, this value is 0.5.

                • Y (float) --

                  The y-coordinate of the landmark expressed as a ratio of the height of the image. The y-coordinate is measured from the top of the image. For example, if the image height is 200 pixels and the y-coordinate of the landmark is at 50 pixels, this value is 0.25.

            • Pose (dict) --

              Indicates the pose of the face as determined by its pitch, roll, and yaw. Default attribute.

              • Roll (float) --

                Value representing the face rotation on the roll axis.

              • Yaw (float) --

                Value representing the face rotation on the yaw axis.

              • Pitch (float) --

                Value representing the face rotation on the pitch axis.

            • Quality (dict) --

              Identifies image brightness and sharpness. Default attribute.

              • Brightness (float) --

                Value representing brightness of the face. The service returns a value between 0 and 100 (inclusive). A higher value indicates a brighter face image.

              • Sharpness (float) --

                Value representing sharpness of the face. The service returns a value between 0 and 100 (inclusive). A higher value indicates a sharper face image.

            • Confidence (float) --

              Confidence level that the bounding box contains a face (and not a different object such as a tree). Default attribute.

GetSegmentDetection (updated) Link ¶
Changes (response)
{'Segments': {'DurationFrames': 'long',
              'EndFrameNumber': 'long',
              'StartFrameNumber': 'long',
              'TechnicalCueSegment': {'Type': {'Content',
                                               'OpeningCredits',
                                               'Slate',
                                               'StudioLogo'}}},
 'VideoMetadata': {'ColorRange': 'FULL | LIMITED'}}

Gets the segment detection results of a Amazon Rekognition Video analysis started by StartSegmentDetection.

Segment detection with Amazon Rekognition Video is an asynchronous operation. You start segment detection by calling StartSegmentDetection which returns a job identifier ( JobId ). When the segment detection operation finishes, Amazon Rekognition publishes a completion status to the Amazon Simple Notification Service topic registered in the initial call to StartSegmentDetection . To get the results of the segment detection operation, first check that the status value published to the Amazon SNS topic is SUCCEEDED . if so, call GetSegmentDetection and pass the job identifier ( JobId ) from the initial call of StartSegmentDetection .

GetSegmentDetection returns detected segments in an array ( Segments ) of SegmentDetection objects. Segments is sorted by the segment types specified in the SegmentTypes input parameter of StartSegmentDetection . Each element of the array includes the detected segment, the precentage confidence in the acuracy of the detected segment, the type of the segment, and the frame in which the segment was detected.

Use SelectedSegmentTypes to find out the type of segment detection requested in the call to StartSegmentDetection .

Use the MaxResults parameter to limit the number of segment detections returned. If there are more results than specified in MaxResults , the value of NextToken in the operation response contains a pagination token for getting the next set of results. To get the next page of results, call GetSegmentDetection and populate the NextToken request parameter with the token value returned from the previous call to GetSegmentDetection .

For more information, see Detecting Video Segments in Stored Video in the Amazon Rekognition Developer Guide.

See also: AWS API Documentation

Request Syntax

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

string

param JobId

[REQUIRED]

Job identifier for the text detection operation for which you want results returned. You get the job identifer from an initial call to StartSegmentDetection .

type MaxResults

integer

param MaxResults

Maximum number of results to return per paginated call. The largest value you can specify is 1000.

type NextToken

string

param NextToken

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

rtype

dict

returns

Response Syntax

{
    'JobStatus': 'IN_PROGRESS'|'SUCCEEDED'|'FAILED',
    'StatusMessage': 'string',
    'VideoMetadata': [
        {
            'Codec': 'string',
            'DurationMillis': 123,
            'Format': 'string',
            'FrameRate': ...,
            'FrameHeight': 123,
            'FrameWidth': 123,
            'ColorRange': 'FULL'|'LIMITED'
        },
    ],
    'AudioMetadata': [
        {
            'Codec': 'string',
            'DurationMillis': 123,
            'SampleRate': 123,
            'NumberOfChannels': 123
        },
    ],
    'NextToken': 'string',
    'Segments': [
        {
            'Type': 'TECHNICAL_CUE'|'SHOT',
            'StartTimestampMillis': 123,
            'EndTimestampMillis': 123,
            'DurationMillis': 123,
            'StartTimecodeSMPTE': 'string',
            'EndTimecodeSMPTE': 'string',
            'DurationSMPTE': 'string',
            'TechnicalCueSegment': {
                'Type': 'ColorBars'|'EndCredits'|'BlackFrames'|'OpeningCredits'|'StudioLogo'|'Slate'|'Content',
                'Confidence': ...
            },
            'ShotSegment': {
                'Index': 123,
                'Confidence': ...
            },
            'StartFrameNumber': 123,
            'EndFrameNumber': 123,
            'DurationFrames': 123
        },
    ],
    'SelectedSegmentTypes': [
        {
            'Type': 'TECHNICAL_CUE'|'SHOT',
            'ModelVersion': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • JobStatus (string) --

      Current status of the segment detection job.

    • StatusMessage (string) --

      If the job fails, StatusMessage provides a descriptive error message.

    • VideoMetadata (list) --

      Currently, Amazon Rekognition Video returns a single object in the VideoMetadata array. The object contains information about the video stream in the input file that Amazon Rekognition Video chose to analyze. The VideoMetadata object includes the video codec, video format and other information. Video metadata is returned in each page of information returned by GetSegmentDetection .

      • (dict) --

        Information about a video that Amazon Rekognition analyzed. Videometadata is returned in every page of paginated responses from a Amazon Rekognition video operation.

        • Codec (string) --

          Type of compression used in the analyzed video.

        • DurationMillis (integer) --

          Length of the video in milliseconds.

        • Format (string) --

          Format of the analyzed video. Possible values are MP4, MOV and AVI.

        • FrameRate (float) --

          Number of frames per second in the video.

        • FrameHeight (integer) --

          Vertical pixel dimension of the video.

        • FrameWidth (integer) --

          Horizontal pixel dimension of the video.

        • ColorRange (string) --

          A description of the range of luminance values in a video, either LIMITED (16 to 235) or FULL (0 to 255).

    • AudioMetadata (list) --

      An array of objects. There can be multiple audio streams. Each AudioMetadata object contains metadata for a single audio stream. Audio information in an AudioMetadata objects includes the audio codec, the number of audio channels, the duration of the audio stream, and the sample rate. Audio metadata is returned in each page of information returned by GetSegmentDetection .

      • (dict) --

        Metadata information about an audio stream. An array of AudioMetadata objects for the audio streams found in a stored video is returned by GetSegmentDetection.

        • Codec (string) --

          The audio codec used to encode or decode the audio stream.

        • DurationMillis (integer) --

          The duration of the audio stream in milliseconds.

        • SampleRate (integer) --

          The sample rate for the audio stream.

        • NumberOfChannels (integer) --

          The number of audio channels in the segment.

    • NextToken (string) --

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

    • Segments (list) --

      An array of segments detected in a video. The array is sorted by the segment types (TECHNICAL_CUE or SHOT) specified in the SegmentTypes input parameter of StartSegmentDetection . Within each segment type the array is sorted by timestamp values.

      • (dict) --

        A technical cue or shot detection segment detected in a video. An array of SegmentDetection objects containing all segments detected in a stored video is returned by GetSegmentDetection.

        • Type (string) --

          The type of the segment. Valid values are TECHNICAL_CUE and SHOT .

        • StartTimestampMillis (integer) --

          The start time of the detected segment in milliseconds from the start of the video. This value is rounded down. For example, if the actual timestamp is 100.6667 milliseconds, Amazon Rekognition Video returns a value of 100 millis.

        • EndTimestampMillis (integer) --

          The end time of the detected segment, in milliseconds, from the start of the video. This value is rounded down.

        • DurationMillis (integer) --

          The duration of the detected segment in milliseconds.

        • StartTimecodeSMPTE (string) --

          The frame-accurate SMPTE timecode, from the start of a video, for the start of a detected segment. StartTimecode is in HH:MM:SS:fr format (and ;fr for drop frame-rates).

        • EndTimecodeSMPTE (string) --

          The frame-accurate SMPTE timecode, from the start of a video, for the end of a detected segment. EndTimecode is in HH:MM:SS:fr format (and ;fr for drop frame-rates).

        • DurationSMPTE (string) --

          The duration of the timecode for the detected segment in SMPTE format.

        • TechnicalCueSegment (dict) --

          If the segment is a technical cue, contains information about the technical cue.

          • Type (string) --

            The type of the technical cue.

          • Confidence (float) --

            The confidence that Amazon Rekognition Video has in the accuracy of the detected segment.

        • ShotSegment (dict) --

          If the segment is a shot detection, contains information about the shot detection.

          • Index (integer) --

            An Identifier for a shot detection segment detected in a video.

          • Confidence (float) --

            The confidence that Amazon Rekognition Video has in the accuracy of the detected segment.

        • StartFrameNumber (integer) --

          The frame number of the start of a video segment, using a frame index that starts with 0.

        • EndFrameNumber (integer) --

          The frame number at the end of a video segment, using a frame index that starts with 0.

        • DurationFrames (integer) --

          The duration of a video segment, expressed in frames.

    • SelectedSegmentTypes (list) --

      An array containing the segment types requested in the call to StartSegmentDetection .

      • (dict) --

        Information about the type of a segment requested in a call to StartSegmentDetection. An array of SegmentTypeInfo objects is returned by the response from GetSegmentDetection.

        • Type (string) --

          The type of a segment (technical cue or shot detection).

        • ModelVersion (string) --

          The version of the model used to detect segments.

GetTextDetection (updated) Link ¶
Changes (response)
{'VideoMetadata': {'ColorRange': 'FULL | LIMITED'}}

Gets the text detection results of a Amazon Rekognition Video analysis started by StartTextDetection.

Text detection with Amazon Rekognition Video is an asynchronous operation. You start text detection by calling StartTextDetection which returns a job identifier ( JobId ) When the text detection operation finishes, Amazon Rekognition publishes a completion status to the Amazon Simple Notification Service topic registered in the initial call to StartTextDetection . 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 of StartLabelDetection .

GetTextDetection returns an array of detected text ( TextDetections ) sorted by the time the text was detected, up to 50 words per frame of video.

Each element of the array includes the detected text, the precentage confidence in the acuracy of the detected text, the time the text was detected, bounding box information for where the text was located, and unique identifiers for words and their lines.

Use MaxResults parameter to limit the number of text detections returned. If there are more results than specified in MaxResults , the value of NextToken in the operation response contains a pagination token for getting the next set of results. To get the next page of results, call GetTextDetection and populate the NextToken request parameter with the token value returned from the previous call to GetTextDetection .

See also: AWS API Documentation

Request Syntax

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

string

param JobId

[REQUIRED]

Job identifier for the text detection operation for which you want results returned. You get the job identifer from an initial call to StartTextDetection .

type MaxResults

integer

param MaxResults

Maximum number of results to return per paginated call. The largest value you can specify is 1000.

type NextToken

string

param NextToken

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

rtype

dict

returns

Response Syntax

{
    'JobStatus': 'IN_PROGRESS'|'SUCCEEDED'|'FAILED',
    'StatusMessage': 'string',
    'VideoMetadata': {
        'Codec': 'string',
        'DurationMillis': 123,
        'Format': 'string',
        'FrameRate': ...,
        'FrameHeight': 123,
        'FrameWidth': 123,
        'ColorRange': 'FULL'|'LIMITED'
    },
    'TextDetections': [
        {
            'Timestamp': 123,
            'TextDetection': {
                'DetectedText': 'string',
                'Type': 'LINE'|'WORD',
                'Id': 123,
                'ParentId': 123,
                'Confidence': ...,
                'Geometry': {
                    'BoundingBox': {
                        'Width': ...,
                        'Height': ...,
                        'Left': ...,
                        'Top': ...
                    },
                    'Polygon': [
                        {
                            'X': ...,
                            'Y': ...
                        },
                    ]
                }
            }
        },
    ],
    'NextToken': 'string',
    'TextModelVersion': 'string'
}

Response Structure

  • (dict) --

    • JobStatus (string) --

      Current status of the text detection job.

    • StatusMessage (string) --

      If the job fails, StatusMessage provides a descriptive error message.

    • VideoMetadata (dict) --

      Information about a video that Amazon Rekognition analyzed. Videometadata is returned in every page of paginated responses from a Amazon Rekognition video operation.

      • Codec (string) --

        Type of compression used in the analyzed video.

      • DurationMillis (integer) --

        Length of the video in milliseconds.

      • Format (string) --

        Format of the analyzed video. Possible values are MP4, MOV and AVI.

      • FrameRate (float) --

        Number of frames per second in the video.

      • FrameHeight (integer) --

        Vertical pixel dimension of the video.

      • FrameWidth (integer) --

        Horizontal pixel dimension of the video.

      • ColorRange (string) --

        A description of the range of luminance values in a video, either LIMITED (16 to 235) or FULL (0 to 255).

    • TextDetections (list) --

      An array of text detected in the video. Each element contains the detected text, the time in milliseconds from the start of the video that the text was detected, and where it was detected on the screen.

      • (dict) --

        Information about text detected in a video. Incudes the detected text, the time in milliseconds from the start of the video that the text was detected, and where it was detected on the screen.

        • Timestamp (integer) --

          The time, in milliseconds from the start of the video, that the text was detected.

        • TextDetection (dict) --

          Details about text detected in a video.

          • 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. The X and Y values returned are ratios of the overall image size. For example, if the input image is 700x200 and the operation returns 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, 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 .

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

    • TextModelVersion (string) --

      Version number of the text detection model that was used to detect text.

StartSegmentDetection (updated) Link ¶
Changes (request)
{'Filters': {'TechnicalCueFilter': {'BlackFrame': {'MaxPixelThreshold': 'float',
                                                   'MinCoveragePercentage': 'float'}}}}

Starts asynchronous detection of segment detection in a stored video.

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

You can use the Filters ( StartSegmentDetectionFilters ) input parameter to specify the minimum detection confidence returned in the response. Within Filters , use ShotFilter ( StartShotDetectionFilter ) to filter detected shots. Use TechnicalCueFilter ( StartTechnicalCueDetectionFilter ) to filter technical cues.

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

For more information, see Detecting Video Segments in Stored Video in the Amazon Rekognition Developer Guide.

See also: AWS API Documentation

Request Syntax

client.start_segment_detection(
    Video={
        'S3Object': {
            'Bucket': 'string',
            'Name': 'string',
            'Version': 'string'
        }
    },
    ClientRequestToken='string',
    NotificationChannel={
        'SNSTopicArn': 'string',
        'RoleArn': 'string'
    },
    JobTag='string',
    Filters={
        'TechnicalCueFilter': {
            'MinSegmentConfidence': ...,
            'BlackFrame': {
                'MaxPixelThreshold': ...,
                'MinCoveragePercentage': ...
            }
        },
        'ShotFilter': {
            'MinSegmentConfidence': ...
        }
    },
    SegmentTypes=[
        'TECHNICAL_CUE'|'SHOT',
    ]
)
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 StartSegmentDetection requests, the same JobId is returned. Use ClientRequestToken to prevent the same job from being accidently started more than once.

type NotificationChannel

dict

param NotificationChannel

The ARN of the Amazon SNS topic to which you want Amazon Rekognition Video to publish the completion status of the segment detection operation. 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.

  • SNSTopicArn (string) -- [REQUIRED]

    The Amazon SNS topic to which Amazon Rekognition to 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 you specify that's returned in the completion notification that's published to 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

Filters for technical cue or shot detection.

  • TechnicalCueFilter (dict) --

    Filters that are specific to technical cues.

    • MinSegmentConfidence (float) --

      Specifies the minimum confidence that Amazon Rekognition Video must have in order to return a detected segment. Confidence represents how certain Amazon Rekognition is that a segment is correctly identified. 0 is the lowest confidence. 100 is the highest confidence. Amazon Rekognition Video doesn't return any segments with a confidence level lower than this specified value.

      If you don't specify MinSegmentConfidence , GetSegmentDetection returns segments with confidence values greater than or equal to 50 percent.

    • BlackFrame (dict) --

      A filter that allows you to control the black frame detection by specifying the black levels and pixel coverage of black pixels in a frame. Videos can come from multiple sources, formats, and time periods, with different standards and varying noise levels for black frames that need to be accounted for.

      • MaxPixelThreshold (float) --

        A threshold used to determine the maximum luminance value for a pixel to be considered black. In a full color range video, luminance values range from 0-255. A pixel value of 0 is pure black, and the most strict filter. The maximum black pixel value is computed as follows: max_black_pixel_value = minimum_luminance + MaxPixelThreshold *luminance_range.

        For example, for a full range video with BlackPixelThreshold = 0.1, max_black_pixel_value is 0 + 0.1 * (255-0) = 25.5.

        The default value of MaxPixelThreshold is 0.2, which maps to a max_black_pixel_value of 51 for a full range video. You can lower this threshold to be more strict on black levels.

      • MinCoveragePercentage (float) --

        The minimum percentage of pixels in a frame that need to have a luminance below the max_black_pixel_value for a frame to be considered a black frame. Luminance is calculated using the BT.709 matrix.

        The default value is 99, which means at least 99% of all pixels in the frame are black pixels as per the MaxPixelThreshold set. You can reduce this value to allow more noise on the black frame.

  • ShotFilter (dict) --

    Filters that are specific to shot detections.

    • MinSegmentConfidence (float) --

      Specifies the minimum confidence that Amazon Rekognition Video must have in order to return a detected segment. Confidence represents how certain Amazon Rekognition is that a segment is correctly identified. 0 is the lowest confidence. 100 is the highest confidence. Amazon Rekognition Video doesn't return any segments with a confidence level lower than this specified value.

      If you don't specify MinSegmentConfidence , the GetSegmentDetection returns segments with confidence values greater than or equal to 50 percent.

type SegmentTypes

list

param SegmentTypes

[REQUIRED]

An array of segment types to detect in the video. Valid values are TECHNICAL_CUE and SHOT.

  • (string) --

rtype

dict

returns

Response Syntax

{
    'JobId': 'string'
}

Response Structure

  • (dict) --

    • JobId (string) --

      Unique identifier for the segment detection job. The JobId is returned from StartSegmentDetection .