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
在一张糟糕的测试图像上(恐怕我不能 post 因为它是身份证件),我得到的 OCR 结果实际上与三个测试用例的实际文本 100% 匹配 -了不起。
但是,当我按照下面 URL 处的示例使用 westeurope 端点时,我得到的 OCR 结果较差 - 缺少一些文本:
这是为什么?更重要的是 - 如何访问 v=18.05 端点?
感谢大家的快速帮助。
我想我明白你的意思了:你没有在你提到的两个页面之间使用相同的操作。
如果您阅读了您提到的工作演示正上方的段落 here 它说:
Get started with the OCR service in general availability, and discover
below a sneak peek of the new preview OCR engine (through "Recognize
Text" API operation) with even better text recognition results for
English.
如果您查看您所指向的其他文档 (this one),他们正在使用 OCR 操作:
vision_base_url = "https://westcentralus.api.cognitive.microsoft.com/vision/v2.0/"
ocr_url = vision_base_url + "ocr"
所以如果你想使用这个新的预览版,把操作改成recognizeText
它在西欧地区可用(参见here),我做了一个快速测试:Azure 演示页面上提供的示例适用于此操作,而另一个不适用。
但是这次操作需要2次调用:
- 一个 POST 操作来提交您的请求(
recognizeText
操作),您将在其中得到一个 202 Accepted
答案和一个 operationId
- 一个 GET 操作来获取结果(
textOperations
操作),使用上一步中的 OperationId。例如:https://westeurope.api.cognitive.microsoft.com/vision/v2.0/textOperations/yourOperationId
演示:
对于微软演示中的关闭标志:
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"
}]
}]
}
}
Azure CS 在
有一个 OCR 演示(westcentralus 端点)https://azure.microsoft.com/en-us/services/cognitive-services/computer-vision/?v=18.05
在一张糟糕的测试图像上(恐怕我不能 post 因为它是身份证件),我得到的 OCR 结果实际上与三个测试用例的实际文本 100% 匹配 -了不起。
但是,当我按照下面 URL 处的示例使用 westeurope 端点时,我得到的 OCR 结果较差 - 缺少一些文本:
这是为什么?更重要的是 - 如何访问 v=18.05 端点?
感谢大家的快速帮助。
我想我明白你的意思了:你没有在你提到的两个页面之间使用相同的操作。
如果您阅读了您提到的工作演示正上方的段落 here 它说:
Get started with the OCR service in general availability, and discover below a sneak peek of the new preview OCR engine (through "Recognize Text" API operation) with even better text recognition results for English.
如果您查看您所指向的其他文档 (this one),他们正在使用 OCR 操作:
vision_base_url = "https://westcentralus.api.cognitive.microsoft.com/vision/v2.0/"
ocr_url = vision_base_url + "ocr"
所以如果你想使用这个新的预览版,把操作改成recognizeText
它在西欧地区可用(参见here),我做了一个快速测试:Azure 演示页面上提供的示例适用于此操作,而另一个不适用。
但是这次操作需要2次调用:
- 一个 POST 操作来提交您的请求(
recognizeText
操作),您将在其中得到一个202 Accepted
答案和一个operationId
- 一个 GET 操作来获取结果(
textOperations
操作),使用上一步中的 OperationId。例如:https://westeurope.api.cognitive.microsoft.com/vision/v2.0/textOperations/yourOperationId
演示:
对于微软演示中的关闭标志:
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"
}]
}]
}
}