Rekognition / Client / get_face_search
get_face_search#
- Rekognition.Client.get_face_search(**kwargs)#
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 toStartFaceSearch
. To get the search results, first check that the status value published to the Amazon SNS topic isSUCCEEDED
. If so, callGetFaceSearch
and pass the job identifier (JobId
) from the initial call toStartFaceSearch
.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. EachPersonMatch
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
, andQuality
). The other facial attributes listed in theFace
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 specifyingINDEX
for theSORTBY
input parameter.See also: AWS API Documentation
Request Syntax
response = client.get_face_search( JobId='string', MaxResults=123, NextToken='string', SortBy='INDEX'|'TIMESTAMP' )
- Parameters:
JobId (string) –
[REQUIRED]
The job identifer for the search request. You get the job identifier from an initial call to
StartFaceSearch
.MaxResults (integer) – 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.
NextToken (string) – 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.
SortBy (string) – Sort to use for grouping faces in the response. Use
TIMESTAMP
to group faces by the time that they are recognized. UseINDEX
to sort by recognized faces.
- Return type:
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': ..., 'FaceOccluded': { 'Value': True|False, 'Confidence': ... }, 'EyeDirection': { 'Yaw': ..., 'Pitch': ..., 'Confidence': ... } } }, 'FaceMatches': [ { 'Similarity': ..., 'Face': { 'FaceId': 'string', 'BoundingBox': { 'Width': ..., 'Height': ..., 'Left': ..., 'Top': ... }, 'ImageId': 'string', 'ExternalImageId': 'string', 'Confidence': ..., 'IndexFacesModelVersion': 'string', 'UserId': 'string' } }, ] }, ], 'JobId': 'string', 'Video': { 'S3Object': { 'Bucket': 'string', 'Name': 'string', 'Version': 'string' } }, 'JobTag': 'string' }
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
. EachPersons
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.
FaceOccluded (dict) –
FaceOccluded
should return “true” with a high confidence score if a detected face’s eyes, nose, and mouth are partially captured or if they are covered by masks, dark sunglasses, cell phones, hands, or other objects.FaceOccluded
should return “false” with a high confidence score if common occurrences that do not impact face verification are detected, such as eye glasses, lightly tinted sunglasses, strands of hair, and others.Value (boolean) –
True if a detected face’s eyes, nose, and mouth are partially captured or if they are covered by masks, dark sunglasses, cell phones, hands, or other objects. False if common occurrences that do not impact face verification are detected, such as eye glasses, lightly tinted sunglasses, strands of hair, and others.
Confidence (float) –
The confidence that the service has detected the presence of a face occlusion.
EyeDirection (dict) –
Indicates the direction the eyes are gazing in, as defined by pitch and yaw.
Yaw (float) –
Value representing eye direction on the yaw axis.
Pitch (float) –
Value representing eye direction on the pitch axis.
Confidence (float) –
The confidence that the service has in its predicted eye direction.
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).
IndexFacesModelVersion (string) –
The version of the face detect and storage model that was used when indexing the face vector.
UserId (string) –
Unique identifier assigned to the user.
JobId (string) –
Job identifier for the face search operation for which you want to obtain results. The job identifer is returned by an initial call to StartFaceSearch.
Video (dict) –
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.
JobTag (string) –
A job identifier specified in the call to StartFaceSearch and returned in the job completion notification sent to your Amazon Simple Notification Service topic.
Exceptions
Rekognition.Client.exceptions.AccessDeniedException
Rekognition.Client.exceptions.InternalServerError
Rekognition.Client.exceptions.InvalidParameterException
Rekognition.Client.exceptions.InvalidPaginationTokenException
Rekognition.Client.exceptions.ProvisionedThroughputExceededException
Rekognition.Client.exceptions.ResourceNotFoundException
Rekognition.Client.exceptions.ThrottlingException