Closed qqeip closed 10 months ago
第一次听说rapidocr-json,去查了这个项目,这是基于CPP的,肯定要比rapidocr_onnxruntime(python)的快的
最好用户可以切换onnx 还是json
这个可以展开说说吗?哪个模型时切换呢?
还有没有三个整合到一起的demo 先方向 再layout 再table
这几个模块,经过简单的逻辑代码即可轻松整合起来。暂无写这个demo的打算哈,欢迎您的贡献。
取ocr_res时 from RapidOCR_api import OcrAPI as RapidOCR
ocrPath = os.getcwd() + "\RapidOCR-json.exe" ocr2 = RapidOCR(exePath=ocrPath)
result = ocr2.run(file_path)
ocr_res = []
# 格式统一 与 rapidocr_onnxruntime PaddleOcr
# rapidocr_json 比rapidocr_onnxruntime更快(34/17s)
# [[42.0, 2.0], [102.0, 2.0], [102.0, 17.0], [42.0, 17.0]], 'Methods', 0.8709095194935799]
for item in result['data']:
text = item['text']
box_coor = item['box']
new_box = [[box_coor[0][0], box_coor[0][1]],
[box_coor[1][0], box_coor[1][1]],
[box_coor[2][0], box_coor[2][1]],
[box_coor[3][0], box_coor[3][1]]]
# new_text = (item['text'], item['score'])
# ocr_res.append([new_box, new_text])
ocr_res.append([new_box, item['text'], item['score']])
print(ocr_res)
result, elapse = table_engine(file_path, ocr_res)
我添加了一个layout+table的 生成HTML列表 rapid_main.zip
取ocr_res时 from RapidOCR_api import OcrAPI as RapidOCR
ocrPath = os.getcwd() + "\RapidOCR-json.exe" ocr2 = RapidOCR(exePath=ocrPath)
ocrres, = ocr_engine(file_path)
result = ocr2.run(file_path) ocr_res = [] # 格式统一 与 rapidocr_onnxruntime PaddleOcr # rapidocr_json 比rapidocr_onnxruntime更快(34/17s) # [[42.0, 2.0], [102.0, 2.0], [102.0, 17.0], [42.0, 17.0]], 'Methods', 0.8709095194935799] for item in result['data']: text = item['text'] box_coor = item['box'] new_box = [[box_coor[0][0], box_coor[0][1]], [box_coor[1][0], box_coor[1][1]], [box_coor[2][0], box_coor[2][1]], [box_coor[3][0], box_coor[3][1]]] # new_text = (item['text'], item['score']) # ocr_res.append([new_box, new_text]) ocr_res.append([new_box, item['text'], item['score']]) print(ocr_res) result, elapse = table_engine(file_path, ocr_res)
这个功能,我看着不具有通用性,我想着可以开放接口,接都是python,但不同推理引擎的rapidocr,像rapidocr_onnxruntime、rapidocr_paddle等
我添加了一个layout+table的 生成HTML列表 rapid_main.zip
感谢,还是建议搞个PR,我这里也方便些😀
已提PR 关了
请您详细描述想要添加的新功能或者是新特性 (Please describe in detail the new function or new feature you want to add) rapidocr_onnxruntime感觉比rapidocr_json 慢好多 最好用户可以切换onnx 还是json 还有没有三个整合到一起的demo 先方向 再layout 再table