1 réponse
- Le plus récent
- Le plus de votes
- La plupart des commentaires
3
Hi THere
That error usually means no face was detected.
From the documentation: If no faces are detected in the source or target images, CompareFaces returns an InvalidParameterException error.
Make sure you are handling errors in your code properly. Heres an example. Its using DetectLabels, but the error handling would be similar for CompareFaces
import boto3
rekognition = boto3.client('rekognition')
try:
response = rekognition.detect_labels(Image={'S3Object': {'Bucket': bucket, 'Name': photo}})
labels = response['Labels']
print(f"Detected labels for {photo}")
for label in labels:
print(f"{label['Name']}: {label['Confidence']}")
except rekognition.exceptions.AmazonRekognitionException as e:
print("Could not complete operation")
print(f"Error Message: {e.message}")
print(f"HTTP Status: {e.response['Error']['Code']}")
print(f"AWS Error Code: {e.response['Error']['Code']}")
print(f"Error Type: {e.response['Error']['Type']}")
print(f"Request ID: {e.response['ResponseMetadata']['RequestId']}")
except Exception as e:
print(f"Internal error occurred communicating with Rekognition: {e}")
Contenus pertinents
- demandé il y a 7 mois
- demandé il y a un an
- demandé il y a un an
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a 7 mois
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a 2 ans
Thanks, Matt. I'm not sure why the error isn't consistent with each photo that doesn't have a face in it. I get 'nope' on most and on this one image I get this error. I can trap for it, for sure but just wish I knew more as to why. Thanks for the quick response.