Ao executar o código de index do rekognition recebo o seguinte erro:
botocore.errorfactory.ResourceNotFoundException:
An error occurred (ResourceNotFoundException) when calling the IndexFaces operation: The collection id: faces does not exist
Meu código:
import boto3
s3 = boto3.resource("s3")
client = boto3.client("rekognition")
def lista_imagens():
image = []
bucket = s3.Bucket("jorgerabellodev-imagens")
for imagem in bucket.objects.all():
image.append(imagem.key)
print(image)
return image
def indexa_colecao(images):
for image in images:
response = client.index_faces(
CollectionId="faces",
DetectionAttributes=[],
ExternalImageId=image[:-4],
Image={
"S3Object": {"Bucket": "jorgerabellodev-imagens", "Name": image},
},
)
imagens = lista_imagens()
indexa_colecao(imagens)