0

我目前正在使用 Azure 表单识别器并有一个问题。我在用

https://<>.cognitiveservices.azure.com/formrecognizer/v2.0-preview/layout/analyzeResults/2e0a2322-65bb-4fd2-a3bf-98f70b36641e

返回的 JSON 似乎正在使用基本的 OCR。我想知道它是否可能(很容易)

拿这个

{
                    "boundingBox": [
                        4.4033,
                        1.5114,
                        6.5483,
                        1.5114,
                        6.5483,
                        1.6407,
                        4.4033,
                        1.6407
                    ],
                    "text": "Invoice For: First Up Consultants",
                    "words": [
                        {
                            "boundingBox": [
                                4.4033,
                                1.5143,
                                4.8234,
                                1.5143,
                                4.8234,
                                1.6155,
                                4.4033,
                                1.6155
                            ],
                            "text": "Invoice",
                            "confidence": 1
                        },
                        {
                            "boundingBox": [
                                4.8793,
                                1.5143,
                                5.1013,
                                1.5143,
                                5.1013,
                                1.6154,
                                4.8793,
                                1.6154
                            ],
                            "text": "For:",
                            "confidence": 1
                        },
                        {
                            "boundingBox": [
                                5.2048,
                                1.5130,
                                5.4927,
                                1.5130,
                                5.4927,
                                1.6151,
                                5.2048,
                                1.6151
                            ],
                            "text": "First",
                            "confidence": 1
                        },
                        {
                            "boundingBox": [
                                5.5427,
                                1.5130,
                                5.7120,
                                1.5130,
                                5.7120,
                                1.6407,
                                5.5427,
                                1.6407
                            ],
                            "text": "Up",
                            "confidence": 1
                        },
                        {
                            "boundingBox": [
                                5.7621,
                                1.5114,
                                6.5483,
                                1.5114,
                                6.5483,
                                1.6151,
                                5.7621,
                                1.6151
                            ],
                            "text": "Consultants",
                            "confidence": 1
                        }
                    ]
                }

但将其返回为

"boundingBox": [
                        4.4033,
                        1.5114,
                        6.5483,
                        1.5114,
                        6.5483,
                        1.6407,
                        4.4033,
                        1.6407
                    ],
                    "text": "Invoice For:",
                    "value": "First Up Consultants"

}

如果这不是我可以在天蓝色表单识别器中做的事情,那么不用担心。我只是想看看。

先感谢您!迈克尔

4

1 回答 1

1

听起来您希望从文档中提取语义。在这种情况下,您可能希望查看使用自定义表单识别器模型。

您可以首先训练自定义模型以提取键值对: https ://docs.microsoft.com/en-us/azure/cognitive-services/form-recognizer/quickstarts/curl-train-extract

示例键值对:

{
    "key": {
        "text": "Address:",
        "boundingBox": [ 0.7972, 1.5125, 1.3958, 1.5125, 1.3958, 1.6431, 0.7972, 1.6431 ]
    },
    "value": {
        "text": "1 Redmond way Suite 6000 Redmond, WA 99243",
        "boundingBox": [ 0.7972, 1.6764, 2.15, 1.6764, 2.15, 2.2181, 0.7972, 2.2181 ]
    },
    "confidence": 0.86
}

或者您可以使用您提供的标签训练自定义模型: https ://docs.microsoft.com/en-us/azure/cognitive-services/form-recognizer/quickstarts/label-tool

示例字段输出:

{
    "total": {
        "type": "string",
        "valueString": "$22,123.24",
        "text": "$22,123.24",
        "boundingBox": [ 5.29, 3.41, 5.975, 3.41, 5.975, 3.54, 5.29, 3.54 ],
        "page": 1,
        "confidence": 1
    }
}
于 2020-07-08T15:16:54.293 回答