簡體   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