【问题标题】:How to add an item in a collection in amazon s3?如何在亚马逊 s3 的集合中添加项目?
【发布时间】:2017-09-19 15:55:17
【问题描述】:

我有这个代码来创建一个数据集合:

import boto3

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

createCollection()

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

【问题讨论】:

    标签: python amazon-web-services amazon-s3 amazon boto3


    【解决方案1】:

    假设您尝试从本地文件系统将图像添加到集合中,您可以使用 index_faces() 方法:

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

    【讨论】:

    • 没问题!如果您满意,请不要忘记接受答案
    猜你喜欢
    • 2014-05-08
    • 1970-01-01
    • 1970-01-01
    • 2022-01-14
    • 2010-10-20
    • 2012-05-01
    • 2018-02-10
    • 2013-05-12
    相关资源
    最近更新 更多