如何在amazons3中添加集合中的项目?

2024-06-16 11:28:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我有创建数据收集的代码:

import boto3

def createCollection():
        cliente = boto3.client('rekognition')
        respuesta = cliente.create_collection (CollectionId = 'Fotos')
        print (respuesta)

createCollection()

但我的问题是如何在这个集合中添加一个项目。 你能帮帮我吗。 谢谢。你知道吗


Tags: 数据代码importclientdefcreateboto3collection
1条回答
网友
1楼 · 发布于 2024-06-16 11:28:10

假设您正试图从本地文件系统向集合添加映像,则可以使用^{}方法:

with open('image.png', 'rb') as image:
    respuesta = cliente.index_faces(Image={'Bytes': image.read()}, CollectionId='Fotos')
    print respuesta

相关问题 更多 >