Olá, Tudo bem?
Na explicação não foi mencionada o uso do atributo CollectionId. Como você definiu seu valor? Tentei fazer o mesmo, mas deu erro. Meu código:
import boto3
s3 = boto3.resource('s3')
client = boto3.client('rekognition', 'us-east-1')
def lista_imagens():
imagens=[]
bucket = s3.Bucket('vmb-imagens')
for imagem in bucket.objects.all():
imagens.append(imagem.key)
print(imagens)
return imagens
def indexando_imagens(imagens):
for i in imagens:
response = client.index_faces(
CollectionId='faces',
Image={
'S3Object': {
'Bucket': 'vmb-imagens',
'Name': i,
}
},
ExternalImageId=i[:-4],
DetectionAttributes=[]
)
imagens=lista_imagens()
indexando_imagens(imagens)
O erro que tomei:
raise error_class(parsed_response, operation_name)
botocore.errorfactory.ResourceNotFoundException: An error occurred (ResourceNotFoundException) when calling the IndexFaces operation: The collection id: faces does not exist