我试图使用aws的识别服务。图像已成功拍摄并上传至S3。但由于某些终点url无法识别。我检查this,我的地区是正确的。
错误讯息:botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://rekognition.us-east-2.amazonaws.com/"
通过doc了解我的终点应该是s3-us-east-2.amazonaws.com
。
对不起,我是新手,请随时指出任何错误。提前致谢
蟒
def detect_labels(bucket, key, max_labels=10, min_confidence=90, region="us-
east-2"):
rekognition = boto3.client("rekognition",region) #tried change rekognition to s3
response = rekognition.detect_labels(
Image={
"S3Object": {
"Bucket": bucket,
"Name": key,
}
},
MaxLabels=max_labels,
MinConfidence=min_confidence,
)
return response['Labels']
takePhoto(file_path, file_name)
uploadToS3(file_path,file_name, BUCKET,location)
for label in detect_labels(BUCKET,file_name):
print("{Name} - {Confidence}%".format(**label))
答案 0 :(得分:0)
Amazon Rekognition目前仅在三个地区提供:us-east-1,us-west-2和eu-west-1。
http://docs.aws.amazon.com/general/latest/gr/rande.html#rekognition_region
您的存储桶需要位于您使用Rekognition的区域。