RapidAI / RapidOCR

Awesome OCR multiple programing languages toolkits based on ONNXRuntime, OpenVION and PaddlePaddle.
https://rapidai.github.io/RapidOCRDocs
Apache License 2.0
2.94k stars 358 forks source link

关于API方式返回结果的一点建议 #45

Closed cuiliang closed 2 years ago

cuiliang commented 2 years ago

从文档里看,目前的返回结果是这样的:

[['0', '香港深圳抽血', '0.93583983'], ['1', '专业查性别', '0.89865875'], ['2', '专业鉴定B超单', '0.9955703'], ['3', 'b超仪器查性别', '0.99489486'], ['4', '加微信eee', '0.99073666'], ['5', '可邮寄', '0.99923944']]

坐标其实还是比较重要的,可以用在后期对内容进行分段处理。

下面的数据格式是我在项目里做的一个api结果的例子。

lines:提供了一个合并后的文本结果。方便直接显示使用。 regions:识别到的区域,每个区域的文字和坐标。

代码在这里 https://github.com/cuiliang/RapidOCR/blob/Quicker/ocrweb/api_task.py
不太懂py,代码只是跟随感觉拼凑的😂,供大佬参考。


{
  "result": {
    "lines": "Filters Is:issueis:open\n\n10pen 35Closed\n\n建议:将ppocr_keys等信息直接存储到onnx模型\n#42 opened 4daysagoby AutumnSun1996",
    "regions": [
      {
        "text": "Filters",
        "confidence": 0.9966548,
        "rect": {
          "left": 57,
          "top": 0,
          "right": 116,
          "bottom": 2
        }
      },
      {
        "text": "Is:issueis:open",
        "confidence": 0.84303313,
        "rect": {
          "left": 210,
          "top": 2,
          "right": 347,
          "bottom": 3
        }
      },
      {
        "text": "10pen",
        "confidence": 0.976416,
        "rect": {
          "left": 89,
          "top": 88,
          "right": 160,
          "bottom": 88
        }
      },
      {
        "text": "35Closed",
        "confidence": 0.9819431,
        "rect": {
          "left": 213,
          "top": 89,
          "right": 305,
          "bottom": 89
        }
      },
      {
        "text": "建议:将ppocr_keys等信息直接存储到onnx模型",
        "confidence": 0.97398514,
        "rect": {
          "left": 90,
          "top": 158,
          "right": 594,
          "bottom": 158
        }
      },
      {
        "text": "#42 opened 4daysagoby AutumnSun1996",
        "confidence": 0.9657532,
        "rect": {
          "left": 91,
          "top": 199,
          "right": 442,
          "bottom": 198
        }
      }
    ]
  },
  "info": {
    "total_elapse": 0.45919999999999994,
    "elapse_part": {
      "det_elapse": "0.3858",
      "cls_elapse": "0.0011",
      "rec_elapse": "0.0723"
    }
  }
}
SWHL commented 2 years ago

好建议,这个我没想到。我改一下,感谢感谢。

SWHL commented 2 years ago
cuiliang commented 2 years ago

👍