Menu

Fixing 'There are no faces in the image' in Rekognition SearchFacesByImage
📰

Fixing 'There are no faces in the image' in Rekognition SearchFacesByImage

DEV Community: computervision·Ashish Sikka·16 days ago
#jOVxQxNH
Reading 0:00
15s threshold

TL;DR SearchFacesByImage first detects the largest face in your input image. If it finds none, it fails with InvalidParameterException: There are no faces in the image. Should be at least 1. The usual causes are a face that is small relative to the frame, a selfie cropped too tightly, an extreme head pose, or a dark or blurry photo. Call DetectFaces on the same bytes to see which one you hit, crop group shots around the face with a margin, and catch the exception so your user gets "try another photo" instead of a 500.

This is the error every selfie-search feature runs into in its first week of real traffic. Test photos work. Then real users upload a photo of themselves from across the room at a wedding, or a selfie their camera app already cropped to the face, and the call fails before any searching happens.

botocore.errorfactory.InvalidParameterException: An error occurred (InvalidParameterException) when calling the SearchFacesByImage operation: There are no faces in the image.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.