File tree Expand file tree Collapse file tree 3 files changed +11
-7
lines changed
Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 3333 unzip wired_table_rec_models.zip
3434 mv wired_table_rec_models/*.onnx wired_table_rec/models/
3535
36- wget https://github.com/RapidAI/TableStructureRec/releases/download/v0.0.0/wired_table_rec_modelsV2.zip
37- unzip wired_table_rec_modelsV2.zip
38- mv cycle_center_net_v2.onnx wired_table_rec/models/
39-
4036 pytest tests/test_wired_table_rec.py
4137
4238 GenerateWHL_PushPyPi :
Original file line number Diff line number Diff line change 1616- ** 2024.9.26**
1717 - 修正RapidTable默认英文模型导致的测评结果错误。
1818 - 补充测评数据集,补充开源社区更多模型的测评结果
19-
19+ - ** 2024.9.30**
20+ - 优化表格类型判断,增加在线演示
21+
2022### 简介
2123💖该仓库是用来对文档中表格做结构化识别的推理库,包括来自paddle的表格识别模型,
2224阿里读光有线和无线表格识别模型,llaipython(微信)贡献的有线表格模型,网易Qanything内置表格分类模型等。
2931
3032🛡️ ** 稳** : 不依赖任何第三方训练框架,只依赖必要基础库,避免包冲突
3133
34+ ### 在线演示
35+ [ modelscope魔塔] ( https://www.modelscope.cn/studios/jockerK/TableRec )
36+ [ huggingface] ( https://huggingface.co/spaces/Joker1212/TableDetAndRec )
3237### 效果展示
3338
3439<div align =" center " >
Original file line number Diff line number Diff line change 11import time
22from pathlib import Path
33
4+ import cv2
45import numpy as np
56import onnxruntime
67from PIL import Image
@@ -39,8 +40,10 @@ def _preprocess(self, image):
3940 def __call__ (self , content : InputType ):
4041 ss = time .perf_counter ()
4142 img = self .load_img (content )
42- img = self ._preprocess (img )
43- output = self .table_cls .run (None , {"input" : img })
43+ gray_img = cv2 .cvtColor (img , cv2 .COLOR_BGR2GRAY )
44+ gray_img = np .stack ((gray_img ,) * 3 , axis = - 1 )
45+ gray_img = self ._preprocess (gray_img )
46+ output = self .table_cls .run (None , {"input" : gray_img })
4447 predict = np .exp (output [0 ] - np .max (output [0 ], axis = 1 , keepdims = True ))
4548 predict /= np .sum (predict , axis = 1 , keepdims = True )
4649 predict_cla = np .argmax (predict , axis = 1 )[0 ]
You can’t perform that action at this time.
0 commit comments