Recognizing celebrities in a stored video
Amazon Rekognition Video celebrity recognition in stored videos is an asynchronous operation. To recognize celebrities in a stored video, use StartCelebrityRecognition to start video analysis. Amazon Rekognition Video publishes the completion status of the video analysis to an Amazon Simple Notification Service topic. If the video analysis is succesful, call GetCelebrityRecognition. to get the analysis results. For more information about starting video analysis and getting the results, see Calling Amazon Rekognition Video operations.
This procedure expands on the code in Analyzing a video stored in an Amazon S3 bucket with Java or Python (SDK), which uses an Amazon SQS queue to get the completion status of a video analysis request. To run this procedure, you need a video file that contains one or more celebrity faces.
To detect celebrities in a video stored in an Amazon S3 bucket (SDK)
-
Perform Analyzing a video stored in an Amazon S3 bucket with Java or Python (SDK).
-
Add the following code to the class
VideoDetect
that you created in step 1.Note If you've already run a video example other than Analyzing a video stored in an Amazon S3 bucket with Java or Python (SDK), the code to replace might be different.
-
Run the code. Information about the celebrities recognized in the video is shown.
GetCelebrityRecognition operation response
The following is an example JSON response. The response includes the following:
-
Recognized celebrities –
Celebrities
is an array of celebrities and the times that they are recognized in a video. A CelebrityRecognition object exists for each time the celebrity is recognized in the video. EachCelebrityRecognition
contains information about a recognized celebrity (CelebrityDetail) and the time (Timestamp
) the celebrity was recognized in the video.Timestamp
is measured in milliseconds from the start of the video. -
CelebrityDetail – Contains information about a recognized celebrity. It includes the celebrity name (
Name
), identifier (ID
), and a list of URLs pointing to related content (Urls
). It also includes the bounding box for the celebrity's body, the confidence level that Amazon Rekognition Video has in the accuracy of the recognition, and details about the celebrity's face, FaceDetail. If you need to get the related content later, you can useID
with GetCelebrityInfo. -
VideoMetadata – Information about the video that was analyzed.
{ "Celebrities": [ { "Celebrity": { "BoundingBox": { "Height": 0.8842592835426331, "Left": 0, "Top": 0.11574073880910873, "Width": 0.24427083134651184 }, "Confidence": 0.699999988079071, "Face": { "BoundingBox": { "Height": 0.20555555820465088, "Left": 0.029374999925494194, "Top": 0.22333332896232605, "Width": 0.11562500149011612 }, "Confidence": 99.89837646484375, "Landmarks": [ { "Type": "eyeLeft", "X": 0.06857934594154358, "Y": 0.30842265486717224 }, { "Type": "eyeRight", "X": 0.10396526008844376, "Y": 0.300625205039978 }, { "Type": "nose", "X": 0.0966852456331253, "Y": 0.34081998467445374 }, { "Type": "mouthLeft", "X": 0.075217105448246, "Y": 0.3811396062374115 }, { "Type": "mouthRight", "X": 0.10744428634643555, "Y": 0.37407416105270386 } ], "Pose": { "Pitch": -0.9784082174301147, "Roll": -8.808176040649414, "Yaw": 20.28228759765625 }, "Quality": { "Brightness": 43.312068939208984, "Sharpness": 99.9305191040039 } }, "Id": "XXXXXX", "Name": "Celeb A", "Urls": [] }, "Timestamp": 367 },...... ], "JobStatus": "SUCCEEDED", "NextToken": "XfXnZKiyMOGDhzBzYUhS5puM+g1IgezqFeYpv/H/+5noP/LmM57FitUAwSQ5D6G4AB/PNwolrw==", "VideoMetadata": { "Codec": "h264", "DurationMillis": 67301, "FileExtension": "mp4", "Format": "QuickTime / MOV", "FrameHeight": 1080, "FrameRate": 29.970029830932617, "FrameWidth": 1920 } }