Amazon Rekognition API-S3元数据问题

Nav*_*een 5 python metadata amazon-s3 amazon-web-services

我正在尝试使用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.
Run Code Online (Sandbox Code Playgroud)

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
Run Code Online (Sandbox Code Playgroud)

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

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

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

谢谢,

Mic*_*bot 5

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

如果存储桶已启用版本控制,则可以指定对象版本。

类型:字符串

长度限制:最小长度为1。最大长度为1024。

必填:否

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

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