gpt4 book ai didi

Azure OCR [打印文本] 未按正确的顺序读取收据行

转载 作者:行者123 更新时间:2023-12-03 00:25:38 25 4
gpt4 key购买 nike

应用程序目标:读取收据图像,提取商店/组织名称以及支付总额。将其输入网络表单以自动填写和提交。

发布请求 - “https://*.cognitiveservices.azure.com/vision/v2.0/recognizeText?{params}

获取请求 - https://*.cognitiveservices.azure.com/vision/v2.0/textOperations/{operationId}

然而,当我得到结果时,有时行排序会令人困惑(见下图[JSON响应中的类似结果]) Screenshot from Azure Computer Vision Page

这种混合导致总计为 0.88 美元

9 张测试收据中有 2 张存在类似情况。

问:为什么它适用于类似和不同结构的收据,但由于某种原因并非所有收据都一致?另外,有什么想法可以解决它吗?

最佳答案

我快速浏览了您的案例。

OCR结果

正如您所提到的,结果并不像您想象的那样排序。我快速查看了边界框值,但不知道它们是如何排序的。您可以尝试基于此合并字段,但有一项服务已经为您完成了这项工作。

表单识别器:

使用表单识别器和您的图像,我得到了以下收据结果。

如下所示,understandingResults 包含 total 及其值(“value”:9.11)、MerchantName(“Chick-fil-a”)等领域。

{
"status": "Succeeded",
"recognitionResults": [
{
"page": 1,
"clockwiseOrientation": 0.17,
"width": 404,
"height": 1226,
"unit": "pixel",
"lines": [
{
"boundingBox": [
108,
55,
297,
56,
296,
71,
107,
70
],
"text": "Welcome to Chick-fil-a",
"words": [
{
"boundingBox": [
108,
56,
169,
56,
169,
71,
108,
71
],
"text": "Welcome",
"confidence": "Low"
},
{
"boundingBox": [
177,
56,
194,
56,
194,
71,
177,
71
],
"text": "to"
},
{
"boundingBox": [
201,
56,
296,
57,
296,
71,
201,
71
],
"text": "Chick-fil-a"
}
]
},
...
OTHER LINES CUT FOR DISPLAY
...
]
}
],
"understandingResults": [
{
"pages": [
1
],
"fields": {
"Subtotal": null,
"Total": {
"valueType": "numberValue",
"value": 9.11,
"text": "$9.11",
"elements": [
{
"$ref": "#/recognitionResults/0/lines/32/words/0"
},
{
"$ref": "#/recognitionResults/0/lines/32/words/1"
}
]
},
"Tax": {
"valueType": "numberValue",
"value": 0.88,
"text": "$0.88",
"elements": [
{
"$ref": "#/recognitionResults/0/lines/31/words/0"
},
{
"$ref": "#/recognitionResults/0/lines/31/words/1"
},
{
"$ref": "#/recognitionResults/0/lines/31/words/2"
}
]
},
"MerchantAddress": null,
"MerchantName": {
"valueType": "stringValue",
"value": "Chick-fil-a",
"text": "Chick-fil-a",
"elements": [
{
"$ref": "#/recognitionResults/0/lines/0/words/2"
}
]
},
"MerchantPhoneNumber": {
"valueType": "stringValue",
"value": "+13092689500",
"text": "309-268-9500",
"elements": [
{
"$ref": "#/recognitionResults/0/lines/4/words/0"
}
]
},
"TransactionDate": {
"valueType": "stringValue",
"value": "2019-06-21",
"text": "6/21/2019",
"elements": [
{
"$ref": "#/recognitionResults/0/lines/6/words/0"
}
]
},
"TransactionTime": {
"valueType": "stringValue",
"value": "13:00:57",
"text": "1:00:57 PM",
"elements": [
{
"$ref": "#/recognitionResults/0/lines/6/words/1"
},
{
"$ref": "#/recognitionResults/0/lines/6/words/2"
}
]
}
}
}
]
}

有关表单识别器的更多详细信息:https://azure.microsoft.com/en-us/services/cognitive-services/form-recognizer/

关于Azure OCR [打印文本] 未按正确的顺序读取收据行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58436452/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com