Skip to content

AWS Rekognition - Searching all faces in input image

0

Hello,

I have a usecase where I have a set of faces (between 50 and 10 000) in a Rekognition collection and I want to match all faces from an image stored in an S3 bucket to check if any of the faces from my collection are in that image. Since I want to match all faces from the input image I can't use SearchFacesByImage since it only matches the largest face from the input image. What am I doing is:

  • Calling IndexFaces on the input image to index faces in my collection
  • Looping on the returned face ids and calling SearchFaces against my collection
  • Calling DeleteFaces with the faces indexed in the first step to avoid polluting my collection and creating "false" match in the future

Since SearchFaces only works with a face id from the collection you are searching in, I feel like I have no option than doing that "Index then Delete pattern".

Is it the right way to go ? I am asking because the quota limit for the DeleteFaces operartion is 5 req/s which seems really low given that pattern, I can have up to 400K images per day to process, and since I have to do this on every image, the quota limit is reached almost instantly.

I know I can ask for a quota increase or simply add some exponential backoff retry, but given how low it is by default I just feel like I may not be doing the things as I should.

Thanks

asked a year ago171 views
1 Answer
1

You're correct that SearchFacesByImage only matches the largest face in an input image, which doesn't meet your requirement to match all faces in an image against your collection.

The approach you're using (IndexFaces → SearchFaces → DeleteFaces) is a valid workaround, but as you've noticed, it has limitations with the DeleteFaces quota.

There is an alternative approach you could consider:

  1. Call DetectFaces on your input image to get the bounding boxes of all faces
  2. Use these bounding boxes to create face crops from the original image
  3. Call SearchFacesByImage for each face crop against your collection

This approach avoids the need to temporarily index and then delete faces from your collection, which would help you avoid hitting the DeleteFaces quota limit. Since you're processing up to 400K images daily, this approach would be more scalable.

The DetectFaces + SearchFacesByImage pattern is specifically mentioned in the Rekognition documentation as an alternative way to search for all faces in an input image.

Contact AWS Support : If you need more information about these operations, contact AWS Support. They can provide additional details about specific API operations and assist you with any questions.

Sources
SearchFacesByImage - Amazon Rekognition
Searching faces in a collection - Amazon Rekognition

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.