Menu
Amazon Rekognition
Developer Guide

RecognizeCelebrities

Returns an array of celebrities recognized in the input image. For more information, see Recognizing Celebrities.

RecognizeCelebrities returns the 15 largest faces in the image. It lists recognized celebrities in the CelebrityFaces list and unrecognized faces in the UnrecognizedFaces list. The operation doesn't return celebrities whose face sizes are smaller than the largest 15 faces in the image.

For each celebrity recognized, the API 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.

Rekognition does not 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 imput image either as base64-encoded image bytes or as a reference to an image in an Amazon S3 bucket. If you use the Amazon 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.

This operation requires permissions to perform the rekognition:RecognizeCelebrities operation.

Request Syntax

Copy
{ "Image": { "Bytes": blob, "S3Object": { "Bucket": "string", "Name": "string", "Version": "string" } } }

Request Parameters

The request accepts the following data in JSON format.

Image

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.

Type: Image object

Required: Yes

Response Syntax

Copy
{ "CelebrityFaces": [ { "Face": { "BoundingBox": { "Height": number, "Left": number, "Top": number, "Width": number }, "Confidence": number, "Landmarks": [ { "Type": "string", "X": number, "Y": number } ], "Pose": { "Pitch": number, "Roll": number, "Yaw": number }, "Quality": { "Brightness": number, "Sharpness": number } }, "Id": "string", "MatchConfidence": number, "Name": "string", "Urls": [ "string" ] } ], "OrientationCorrection": "string", "UnrecognizedFaces": [ { "BoundingBox": { "Height": number, "Left": number, "Top": number, "Width": number }, "Confidence": number, "Landmarks": [ { "Type": "string", "X": number, "Y": number } ], "Pose": { "Pitch": number, "Roll": number, "Yaw": number }, "Quality": { "Brightness": number, "Sharpness": number } } ] }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

CelebrityFaces

Details about each celebrity found in the image. Amazon Rekognition can detect a maximum of 15 celebrities in an image.

Type: Array of Celebrity objects

OrientationCorrection

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

Type: String

Valid Values: ROTATE_0 | ROTATE_90 | ROTATE_180 | ROTATE_270

UnrecognizedFaces

Details about each unrecognized face in the image.

Type: Array of ComparedFace objects

Errors

AccessDeniedException

You are not authorized to perform the action.

HTTP Status Code: 400

ImageTooLargeException

The input image size exceeds the allowed limit. For more information, see Limits in Amazon Rekognition.

HTTP Status Code: 400

InternalServerError

Amazon Rekognition experienced a service issue. Try your call again.

HTTP Status Code: 500

InvalidImageFormatException

The provided image format is not supported.

HTTP Status Code: 400

InvalidImageFormatException

The provided image format is not supported.

HTTP Status Code: 400

InvalidParameterException

Input parameter violated a constraint. Validate your parameter before calling the API operation again.

HTTP Status Code: 400

InvalidS3ObjectException

Amazon Rekognition is unable to access the S3 object specified in the request.

HTTP Status Code: 400

ProvisionedThroughputExceededException

The number of requests exceeded your throughput limit. If you want to increase this limit, contact Amazon Rekognition.

HTTP Status Code: 400

ThrottlingException

Amazon Rekognition is temporarily unable to process the request. Try your call again.

HTTP Status Code: 500

Example

Example Request

The following example recognizes celebrities in an image (image.jpg) stored in an Amazon S3 bucket (photo-collection).

Sample Request

Copy
POST https://rekognition.us-west-2.amazonaws.com/ HTTP/1.1 Host: rekognition.us-west-2.amazonaws.com Accept-Encoding: identity Content-Length: 83 X-Amz-Target: RekognitionService.RecognizeCelebrities X-Amz-Date: 20170414T195420Z User-Agent: aws-cli/1.11.47 Python/2.7.9 Windows/8 botocore/1.5.10 Content-Type: application/x-amz-json-1.1 Authorization: AWS4-HMAC-SHA256 Credential=XXXX/20170414/us-west-2/rekognition/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX { "Image": { "S3Object": { "Bucket": "photo-collection", "Name": "image.jpg" } } }

Sample Response

Copy
{ "CelebrityFaces": [{ "Face": { "BoundingBox": { "Height": 0.617123007774353, "Left": 0.15641026198863983, "Top": 0.10864841192960739, "Width": 0.3641025722026825 }, "Confidence": 99.99589538574219, "Landmarks": [{ "Type": "eyeLeft", "X": 0.2837241291999817, "Y": 0.3637104034423828 }, { "Type": "eyeRight", "X": 0.4091649055480957, "Y": 0.37378931045532227 }, { "Type": "nose", "X": 0.35267341136932373, "Y": 0.49657556414604187 }, { "Type": "mouthLeft", "X": 0.2786353826522827, "Y": 0.5455248355865479 }, { "Type": "mouthRight", "X": 0.39566439390182495, "Y": 0.5597742199897766 }], "Pose": { "Pitch": -7.749263763427734, "Roll": 2.004552125930786, "Yaw": 9.012002944946289 }, "Quality": { "Brightness": 32.69192123413086, "Sharpness": 99.9305191040039 } }, "Id": "3Ir0du6", "MatchConfidence": 98.0, "Name": "Jeff Bezos", "Urls": ["www.imdb.com/name/nm1757263"] }], "OrientationCorrection": "ROTATE_0", "UnrecognizedFaces": [{ "BoundingBox": { "Height": 0.5345501899719238, "Left": 0.48461538553237915, "Top": 0.16949152946472168, "Width": 0.3153846263885498 }, "Confidence": 99.92860412597656, "Landmarks": [{ "Type": "eyeLeft", "X": 0.5863404870033264, "Y": 0.36940744519233704 }, { "Type": "eyeRight", "X": 0.6999204754829407, "Y": 0.3769848346710205 }, { "Type": "nose", "X": 0.6349524259567261, "Y": 0.4804527163505554 }, { "Type": "mouthLeft", "X": 0.5872702598571777, "Y": 0.5535582304000854 }, { "Type": "mouthRight", "X": 0.6952020525932312, "Y": 0.5600858926773071 }], "Pose": { "Pitch": -7.386096477508545, "Roll": 2.304218292236328, "Yaw": -6.175624370574951 }, "Quality": { "Brightness": 37.16635513305664, "Sharpness": 99.884521484375 } }] }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: