Boto3 InvalidParameterException

I found it in boto/cognito/identity/exceptions.py:

from boto.exception import BotoServerError

class InvalidParameterException(BotoServerError):
    pass

If you saw this exception in response to calling search_faces_by_image then it probably indicates that there were no detectable faces in the image that you provided. You can review a list of possible exceptions at API_SearchFacesByImage.

To handle this exception, you could write code like this:

import boto3
rek = boto3.client('rekognition')

def lookup_faces(image, collection_id):
    try:
        faces = rek.search_faces_by_image(
            CollectionId=collection_id,
            Image=image,
            FaceMatchThreshold=95
        )
        logger.info('faces detected: {}'.format(faces))
        return faces
    except rek.exceptions.InvalidParameterException as e:
        logger.debug('no faces detected')
        return None