繁体   English   中英

Azure 认知服务 OCR 给出不同的结果 - 如何补救?

[英]Azure Cognitive Services OCR giving differing results - how to remedy?

Azure CS 有一个 OCR 演示(westcentralus 端点),位于

https://azure.microsoft.com/en-us/services/cognitive-services/computer-vision/?v=18.05

在糟糕的测试图像上(我恐怕无法发布,因为它是身份证件),我得到的 OCR 结果实际上与三个测试用例的实际文本 100% 匹配 - 非常了不起。

但是,当我按照以下 URL 中的示例使用西欧端点进行操作时,我得到的 OCR 结果较差 - 缺少一些文本:

https://docs.microsoft.com/en-us/azure/cognitive-services/Computer-vision/quickstarts/python-print-text

为什么是这样? 更重要的是 - 如何访问 v=18.05 端点?

感谢所有快速帮助。

我想我明白你的意思:你没有在你提到的两页之间使用相同的操作。

如果您阅读了您在此处提到的工作演示上方的段落,它会说:

开始使用公开可用的 OCR 服务,并在下面发现新的预览版 OCR 引擎(通过“识别文本”API 操作)具有更好的英语文本识别结果。

如果您查看您指向的其他文档( 文档),他们正在使用 OCR 操作:

vision_base_url = "https://westcentralus.api.cognitive.microsoft.com/vision/v2.0/"

ocr_url = vision_base_url + "ocr"

所以如果你想使用这个新的预览版,把操作改成recognizeText

它在西欧地区可用(请参阅此处),我做了一个快速测试:Azure 演示页面上提供的示例适用于此操作,而不适用于另一个。

但是这次操作需要2次调用:

  • 一个 POST 操作来提交您的请求( recognizeText操作),您将在其中获得一个带有operationId202 Accepted答案
  • 使用上一步中的 OperationId 获取结果的一个 GET 操作( textOperations操作)。 例如: https://westeurope.api.cognitive.microsoft.com/vision/v2.0/textOperations/yourOperationId : https://westeurope.api.cognitive.microsoft.com/vision/v2.0/textOperations/yourOperationId

演示:

对于来自 Microsoft Demos 的 CLOSED 标志:

OCR 操作的结果:

{
  "language": "unk",
  "orientation": "NotDetected",
  "textAngle": 0.0,
  "regions": []
}

RecognizeText 的结果:

{
  "status": "Succeeded",
  "recognitionResult": {
    "lines": [{
      "boundingBox": [174, 488, 668, 675, 617, 810, 123, 622],
      "text": "CLOSED",
      "words": [{
        "boundingBox": [164, 494, 659, 673, 621, 810, 129, 628],
        "text": "CLOSED"
      }]
    }, {
      "boundingBox": [143, 641, 601, 811, 589, 843, 132, 673],
      "text": "WHEN ONE DOOR CLOSES, ANOTHER",
      "words": [{
        "boundingBox": [147, 646, 217, 671, 205, 698, 134, 669],
        "text": "WHEN"
      }, {
        "boundingBox": [230, 675, 281, 694, 269, 724, 218, 703],
        "text": "ONE"
      }, {
        "boundingBox": [291, 697, 359, 722, 348, 754, 279, 727],
        "text": "DOOR"
      }, {
        "boundingBox": [370, 726, 479, 767, 469, 798, 359, 758],
        "text": "CLOSES,"
      }, {
        "boundingBox": [476, 766, 598, 812, 588, 839, 466, 797],
        "text": "ANOTHER"
      }]
    }, {
      "boundingBox": [56, 668, 645, 886, 633, 919, 44, 700],
      "text": "OPENS.ALL YOU HAVE TO DO IS WALK IN",
      "words": [{
        "boundingBox": [74, 677, 223, 731, 213, 764, 65, 707],
        "text": "OPENS.ALL"
      }, {
        "boundingBox": [233, 735, 291, 756, 280, 789, 223, 767],
        "text": "YOU"
      }, {
        "boundingBox": [298, 759, 377, 788, 367, 821, 288, 792],
        "text": "HAVE"
      }, {
        "boundingBox": [387, 792, 423, 805, 413, 838, 376, 824],
        "text": "TO"
      }, {
        "boundingBox": [431, 808, 472, 824, 461, 855, 420, 841],
        "text": "DO"
      }, {
        "boundingBox": [479, 826, 510, 838, 499, 869, 468, 858],
        "text": "IS"
      }, {
        "boundingBox": [518, 841, 598, 872, 587, 901, 506, 872],
        "text": "WALK"
      }, {
        "boundingBox": [606, 875, 639, 887, 627, 916, 594, 904],
        "text": "IN"
      }]
    }]
  }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM