我正在使用Google Vision OCR在Python中从图像中提取文本。使用以下代码片段。然而,置信度得分总是显示为0.0,这明显是不正确的。
如何从Google响应中提取单个字符或单词的OCR置信度得分?
如何从Google响应中提取单个字符或单词的OCR置信度得分?
content = cv2.imencode('.jpg', cv2.imread(file_name))[1].tostring()
img = types.Image(content=content)
response1 = client.text_detection(image=img, image_context={"language_hints": ["en"]})
response_annotations = response1.text_annotations
for x in response1.text_annotations:
print(x)
print(f'confidence:{x.confidence}')
例如:一次迭代的输出结果
description: "Date:"
bounding_poly {
vertices {
x: 127
y: 11
}
vertices {
x: 181
y: 10
}
vertices {
x: 181
y: 29
}
vertices {
x: 127
y: 30
}
}
confidence:0.0
google-cloud-vision==1.0.0
时遇到了相同的问题。 - hzitoun