AWS Rekognition limits on collections

Viewed 1027

If I was using IndexFaces, you need to supply a image and a collection id that will then add the faces in the image to the collection id specified. Lets say I gave a collection id on a collection that contains one million faces, which is the limit of collections in AWS Rekognition. Therefore adding more faces to this collection would throw an error (I think) cause then this would surpass the limit of one million faces in the collection. So I was wondering what error would be thrown by IndexFaces and/or how to tell on AWS rekognition the number of faces in my collection? I have listed the error list below for IndexFaces in case it helps.

AccessDeniedException You are not authorized to perform the action.

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

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

InvalidImageFormatException The provided image format is not supported.

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

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

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

ResourceNotFoundException Collection specified in the request is not found.

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

1 Answers

I do not know what error would cause, but what I do is to count the number of faces in a collection in the following way:

$list = $this->client->listFaces([
    'CollectionId' => 'nombrecoleccion',
]);

$substr = substr($list, 294);
$json = json_decode($substr);
$result = $json->{'Faces'};
for ($i = 0; $i < count($result); $i++) {
     $faces[$i] = $result[$i]->{'FaceId'};
}
count($faces);
Related