Rekognition.Client.
recognize_celebrities
(**kwargs)¶Returns an array of celebrities recognized in the input image. For more information, see Recognizing celebrities in the Amazon Rekognition Developer Guide.
RecognizeCelebrities
returns the 64 largest faces in the image. It lists the recognized celebrities in theCelebrityFaces
array and any unrecognized faces in theUnrecognizedFaces
array.RecognizeCelebrities
doesn't return celebrities whose faces aren't among the largest 64 faces in the image.
For each celebrity recognized, RecognizeCelebrities
returns a Celebrity
object. The Celebrity
object contains the celebrity name, ID, URL links to additional information, match confidence, and a ComparedFace
object that you can use to locate the celebrity's face on the image.
Amazon Rekognition doesn't retain information about which images a celebrity has been recognized in. Your application must store this information and use the Celebrity
ID property as a unique identifier for the celebrity. If you don't store the celebrity name or additional information URLs returned by RecognizeCelebrities
, you will need the ID to identify the celebrity in a call to the GetCelebrityInfo operation.
You pass the input image either as base64-encoded image bytes or as a reference to an image in an Amazon S3 bucket. If you use the AWS CLI to call Amazon Rekognition operations, passing image bytes is not supported. The image must be either a PNG or JPEG formatted file.
For an example, see Recognizing celebrities in an image in the Amazon Rekognition Developer Guide.
This operation requires permissions to perform the rekognition:RecognizeCelebrities
operation.
See also: AWS API Documentation
Request Syntax
response = client.recognize_celebrities(
Image={
'Bytes': b'bytes',
'S3Object': {
'Bucket': 'string',
'Name': 'string',
'Version': 'string'
}
}
)
[REQUIRED]
The input image as base64-encoded bytes or an S3 object. If you use the AWS CLI to call Amazon Rekognition operations, passing base64-encoded image bytes is not supported.
If you are using an AWS SDK to call Amazon Rekognition, you might not need to base64-encode image bytes passed using the Bytes
field. For more information, see Images in the Amazon Rekognition developer guide.
Blob of image bytes up to 5 MBs.
Identifies an S3 object as the image source.
Name of the S3 bucket.
S3 object key name.
If the bucket is versioning enabled, you can specify the object version.
{
'CelebrityFaces': [
{
'Urls': [
'string',
],
'Name': 'string',
'Id': 'string',
'Face': {
'BoundingBox': {
'Width': ...,
'Height': ...,
'Left': ...,
'Top': ...
},
'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': ...
},
'Emotions': [
{
'Type': 'HAPPY'|'SAD'|'ANGRY'|'CONFUSED'|'DISGUSTED'|'SURPRISED'|'CALM'|'UNKNOWN'|'FEAR',
'Confidence': ...
},
],
'Smile': {
'Value': True|False,
'Confidence': ...
}
},
'MatchConfidence': ...,
'KnownGender': {
'Type': 'Male'|'Female'|'Nonbinary'|'Unlisted'
}
},
],
'UnrecognizedFaces': [
{
'BoundingBox': {
'Width': ...,
'Height': ...,
'Left': ...,
'Top': ...
},
'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': ...
},
'Emotions': [
{
'Type': 'HAPPY'|'SAD'|'ANGRY'|'CONFUSED'|'DISGUSTED'|'SURPRISED'|'CALM'|'UNKNOWN'|'FEAR',
'Confidence': ...
},
],
'Smile': {
'Value': True|False,
'Confidence': ...
}
},
],
'OrientationCorrection': 'ROTATE_0'|'ROTATE_90'|'ROTATE_180'|'ROTATE_270'
}
Response Structure
Details about each celebrity found in the image. Amazon Rekognition can detect a maximum of 64 celebrities in an image. Each celebrity object includes the following attributes: Face
, Confidence
, Emotions
, Landmarks
, Pose
, Quality
, Smile
, Id
, KnownGender
, MatchConfidence
, Name
, Urls
.
Provides information about a celebrity recognized by the RecognizeCelebrities operation.
An array of URLs pointing to additional information about the celebrity. If there is no additional information about the celebrity, this list is empty.
The name of the celebrity.
A unique identifier for the celebrity.
Provides information about the celebrity's face, such as its location on the image.
Bounding box of the face.
Width of the bounding box as a ratio of the overall image width.
Height of the bounding box as a ratio of the overall image height.
Left coordinate of the bounding box as a ratio of overall image width.
Top coordinate of the bounding box as a ratio of overall image height.
Level of confidence that what the bounding box contains is a face.
An array of facial landmarks.
Indicates the location of the landmark on the face.
Type of landmark.
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.
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.
Indicates the pose of the face as determined by its pitch, roll, and yaw.
Value representing the face rotation on the roll axis.
Value representing the face rotation on the yaw axis.
Value representing the face rotation on the pitch axis.
Identifies face image brightness and sharpness.
Value representing brightness of the face. The service returns a value between 0 and 100 (inclusive). A higher value indicates a brighter face image.
Value representing sharpness of the face. The service returns a value between 0 and 100 (inclusive). A higher value indicates a sharper face image.
The emotions that appear to be expressed on the face, and the confidence level in the determination. Valid values include "Happy", "Sad", "Angry", "Confused", "Disgusted", "Surprised", "Calm", "Unknown", and "Fear".
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 of emotion detected.
Level of confidence in the determination.
Indicates whether or not the face is smiling, and the confidence level in the determination.
Boolean value that indicates whether the face is smiling or not.
Level of confidence in the determination.
The confidence, in percentage, that Amazon Rekognition has that the recognized face is the celebrity.
The known gender identity for the celebrity that matches the provided ID. The known gender identity can be Male, Female, Nonbinary, or Unlisted.
A string value of the KnownGender info about the Celebrity.
Details about each unrecognized face in the image.
Provides face metadata for target image faces that are analyzed by CompareFaces
and RecognizeCelebrities
.
Bounding box of the face.
Width of the bounding box as a ratio of the overall image width.
Height of the bounding box as a ratio of the overall image height.
Left coordinate of the bounding box as a ratio of overall image width.
Top coordinate of the bounding box as a ratio of overall image height.
Level of confidence that what the bounding box contains is a face.
An array of facial landmarks.
Indicates the location of the landmark on the face.
Type of landmark.
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.
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.
Indicates the pose of the face as determined by its pitch, roll, and yaw.
Value representing the face rotation on the roll axis.
Value representing the face rotation on the yaw axis.
Value representing the face rotation on the pitch axis.
Identifies face image brightness and sharpness.
Value representing brightness of the face. The service returns a value between 0 and 100 (inclusive). A higher value indicates a brighter face image.
Value representing sharpness of the face. The service returns a value between 0 and 100 (inclusive). A higher value indicates a sharper face image.
The emotions that appear to be expressed on the face, and the confidence level in the determination. Valid values include "Happy", "Sad", "Angry", "Confused", "Disgusted", "Surprised", "Calm", "Unknown", and "Fear".
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 of emotion detected.
Level of confidence in the determination.
Indicates whether or not the face is smiling, and the confidence level in the determination.
Boolean value that indicates whether the face is smiling or not.
Level of confidence in the determination.
Note
Support for estimating image orientation using the the OrientationCorrection field has ceased as of August 2021. Any returned values for this field included in an API response will always be NULL.
The orientation of the input image (counterclockwise direction). If your application displays the image, you can use this value to correct the orientation. The bounding box coordinates returned in CelebrityFaces
and UnrecognizedFaces
represent face locations before the image orientation is corrected.
Note
If the input image is in .jpeg format, it might contain exchangeable image (Exif) metadata that includes the image's orientation. If so, and the Exif metadata for the input image populates the orientation field, the value of OrientationCorrection
is null. The CelebrityFaces
and UnrecognizedFaces
bounding box coordinates represent face locations after Exif metadata is used to correct the image orientation. Images in .png format don't contain Exif metadata.
Exceptions
Rekognition.Client.exceptions.InvalidS3ObjectException
Rekognition.Client.exceptions.InvalidParameterException
Rekognition.Client.exceptions.InvalidImageFormatException
Rekognition.Client.exceptions.ImageTooLargeException
Rekognition.Client.exceptions.AccessDeniedException
Rekognition.Client.exceptions.InternalServerError
Rekognition.Client.exceptions.ThrottlingException
Rekognition.Client.exceptions.ProvisionedThroughputExceededException
Rekognition.Client.exceptions.InvalidImageFormatException