gpt4 book ai didi

python - Amazon Rekognition API - S3 元数据问题

转载 作者:太空狗 更新时间:2023-10-30 00:59:26 28 4
gpt4 key购买 nike

我正在尝试使用 AWS Image Rekognition API 检测图像中的人脸。但是出现以下错误:

错误1:

ClientError: An error occurred (InvalidS3ObjectException) when calling the DetectFaces operation: Unable to get image metadata from S3.  Check object key, region and/or access permissions.

Python 代码 1:

def detect_faces(object_name="path/to/image/001.jpg"):
client = get_aws_client('rekognition')

response = client.detect_faces(
Image={
# 'Bytes': source_bytes,
'S3Object': {
'Bucket': "bucket-name",
'Name': object_name,
'Version': 'string'
}
},
Attributes=[
'ALL',
]
)

return response

对象“path/to/image/001.jpg”存在于 AWS S3 存储桶“bucket-name”中。并且区域名称也是正确的。

此对象“001.jpg”的权限是:每个人都被授予打开/下载/查看权限。对象的元数据:内容类型:图像/jpeg

不确定如何调试它。有什么解决这个问题的建议吗?

谢谢,

最佳答案

您似乎要求服务获取版本 ID 为 string 的对象。

Version

If the bucket is versioning enabled, you can specify the object version.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: No

http://docs.aws.amazon.com/rekognition/latest/dg/API_S3Object.html#rekognition-Type-S3Object-Version

从您的请求参数中删除 'Version': 'string' ,除非您真的打算从版本化存储桶中获取特定版本的对象,在这种情况下,请提供实际版本 ID有问题的对象。

关于python - Amazon Rekognition API - S3 元数据问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41523004/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com