演示页面和控制台之间的 Azure OCR 区别

Azure OCR difference between demo page and console

我有几个需要使用 OCR 识别的图像示例。

我已经尝试在演示页面 https://azure.microsoft.com/en-us/services/cognitive-services/computer-vision/ 上识别它们并且效果很好。我使用 "Read text in images" 选项,它比 "Read handwritten text from images".

效果更好

但是当我尝试从脚本使用 REST 调用时(根据文档中给出的示例),结果要差得多。有些字母被识别错误,有些完全错过了。如果我尝试 运行 来自开发控制台的相同示例 https://westcentralus.dev.cognitive.microsoft.com/docs/services/5adf991815e1060e6355ad44/operations/56f91f2e778daf14a499e1fc/console 我仍然会得到同样糟糕的结果。

是什么导致了这种差异?我怎样才能修复它以获得演示页面生成的可靠结果?

可能还需要其他信息?

更新:因为我找不到任何解决方案,甚至找不到差异的解释,所以我创建了一个示例文件(类似于实际文件),以便您查看。文件 url 是 http://sfiles.herokuapp.com/sample.png

你可以看到,如果在 "Read text in images" 部分的演示页面 https://azure.microsoft.com/en-us/services/cognitive-services/computer-vision/ 上使用它,结果 JSON 是

{
  "status": "Succeeded",
  "succeeded": true,
  "failed": false,
  "finished": true,
  "recognitionResult": {
    "lines": [
      {
        "boundingBox": [
          307,
          159,
          385,
          158,
          386,
          173,
          308,
          174
        ],
        "text": "October 2011",
        "words": [
          {
            "boundingBox": [
              308,
              160,
              357,
              160,
              357,
              174,
              308,
              175
            ],
            "text": "October"
          },
          {
            "boundingBox": [
              357,
              160,
              387,
              159,
              387,
              174,
              357,
              174
            ],
            "text": "2011"
          }
        ]
      },
      {
        "boundingBox": [
          426,
          157,
          519,
          158,
          519,
          173,
          425,
          172
        ],
        "text": "07UC14PII0244",
        "words": [
          {
            "boundingBox": [
              426,
              160,
              520,
              159,
              520,
              174,
              426,
              174
            ],
            "text": "07UC14PII0244"
          }
        ]
      }
    ]
  }
}

如果我在控制台中使用此文件并进行以下调用:

POST https://westcentralus.api.cognitive.microsoft.com/vision/v2.0/ocr?language=unk&detectOrientation =true HTTP/1.1
Host: westcentralus.api.cognitive.microsoft.com
Content-Type: application/json
Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••

{"url":"http://sfiles.herokuapp.com/sample.png"}

我得到不同的结果:

{
  "language": "el",
  "textAngle": 0.0,
  "orientation": "Up",
  "regions": [{
    "boundingBox": "309,161,75,10",
    "lines": [{
      "boundingBox": "309,161,75,10",
      "words": [{
        "boundingBox": "309,161,46,10",
        "text": "October"
      }, {
        "boundingBox": "358,162,26,9",
        "text": "2011"
      }]
    }]
  }, {
    "boundingBox": "428,161,92,10",
    "lines": [{
      "boundingBox": "428,161,92,10",
      "words": [{
        "boundingBox": "428,161,92,10",
        "text": "071_lC14P110244"
      }]
    }]
  }]
}

如您所见,结果完全不同(甚至 JSON 格式)。有谁知道我做错了什么,或者我遗漏了什么,"Read text in images"演示与API的ocr方法不匹配?

如有任何帮助,我们将不胜感激。

Microsoft 认知服务中有两种类型的 OCR。较新的端点(/recognizeText)具有更好的识别能力,但目前仅支持英语。较旧的端点 (/ocr) 具有更广泛的语言覆盖范围。

.

中提供了一些关于差异的其他详细信息