我正在尝试按照 AWS 文档中的说明使用 AWS Rekognitionthrough Python boto3 比较人脸。
我的 API 调用是:
client = boto3.client('rekognition', aws_access_key_id=key, aws_secret_access_key=secret, region_name=region )
source_bytes = open('source.jpg', 'rb')
target_bytes = open('target.jpg', 'rb')
response = client.compare_faces(
SourceImage = {
'Bytes':bytearray(source_bytes.read())
},
TargetImage = {
'Bytes':bytearray(target_bytes.read())
},
SimilarityThreshold = SIMILARITY_THRESHOLD
)
source_image.close()
target_image.close()
但是每次我运行这个程序时,我都会收到以下错误:
botocore.errorfactory.InvalidParameterException: An error occurred (InvalidParameterException) when calling the CompareFaces operation: Request has Invalid Parameters
我已经正确指定了秘密、密钥、区域和阈值。如何清除此错误并使请求调用正常工作?