|
14 | 14 | - **2024.10.15** |
15 | 15 | - 完成初版代码,包含目标检测,语义分割,角点方向识别三个模块 |
16 | 16 | - **2024.11.2** |
17 | | - - 补充新训练yolo11的目标检测模型和边缘检测模型,增加自动下载,轻量化包体积,自由组合各个模块 |
| 17 | + - 补充新训练yolo11的目标检测模型和边缘检测模型 |
| 18 | + - 增加自动下载,轻量化包体积 |
| 19 | + - 补充onnx-gpu推理支持,给出benchmark测试结果 |
| 20 | + - 补充在线示例使用 |
18 | 21 |
|
19 | 22 | ### 简介 |
20 | 23 |
|
21 | 24 | 💡✨ 强大且高效的表格检测,支持论文、期刊、杂志、发票、收据、签到单等各种表格。 |
22 | 25 |
|
23 | | -🚀 支持来源于paddle和yolo的版本,平衡速度和精度下单图 CPU 推理仅需 1.2 秒,onnx-GPU(V100) 最小组合仅需 0.4 秒,使用pt和paddle模型还能更快!(这个有需要后面再更新吧) |
24 | | - |
| 26 | +🚀 支持来源于paddle和yolo的版本,默认模型组合单图 CPU 推理仅需 1.2 秒,onnx-GPU(V100) 最小组合仅需 0.4 秒,paddle-gpu版0.2s |
25 | 27 | 🛠️ 支持三个模块自由组合,独立训练调优,提供 ONNX 转换脚本和微调训练方案。 |
26 | 28 |
|
27 | 29 | 🌟 whl 包轻松集成使用,为下游 OCR、表格识别和数据采集提供强力支撑。 |
@@ -86,7 +88,7 @@ use_cls_det=True, |
86 | 88 | ``` python {linenos=table} |
87 | 89 | from rapid_table_det.inference import TableDetector |
88 | 90 |
|
89 | | -img_path = f"images/weixin.png" |
| 91 | +img_path = f"tests/test_files/chip.jpg" |
90 | 92 | table_det = TableDetector() |
91 | 93 |
|
92 | 94 | result, elapse = table_det(img_path) |
@@ -116,6 +118,49 @@ print( |
116 | 118 | # cv2.imwrite(f"{out_dir}/{file_name}-extract-{i}.jpg", wrapped_img) |
117 | 119 | # cv2.imwrite(f"{out_dir}/{file_name}-visualize.jpg", img) |
118 | 120 |
|
| 121 | +``` |
| 122 | +### paddle版本使用 |
| 123 | +必须下载模型,指定模型位置! |
| 124 | +``` python {linenos=table} |
| 125 | +# 建议使用清华源安装 https://pypi.tuna.tsinghua.edu.cn/simple |
| 126 | +pip install rapid-table-det-paddle (默认安装gpu版本,可以自行覆盖安装cpu版本paddlepaddle) |
| 127 | +``` |
| 128 | +```python |
| 129 | +from rapid_table_det_paddle.inference import TableDetector |
| 130 | + |
| 131 | +img_path = f"tests/test_files/chip.jpg" |
| 132 | + |
| 133 | +table_det = TableDetector( |
| 134 | + obj_model_path="models/obj_det_paddle", |
| 135 | + edge_model_path="models/edge_det_paddle", |
| 136 | + cls_model_path="models/cls_det_paddle", |
| 137 | + use_obj_det=True, |
| 138 | + use_edge_det=True, |
| 139 | + use_cls_det=True, |
| 140 | +) |
| 141 | +result, elapse = table_det(img_path) |
| 142 | +obj_det_elapse, edge_elapse, rotate_det_elapse = elapse |
| 143 | +print( |
| 144 | + f"obj_det_elapse:{obj_det_elapse}, edge_elapse={edge_elapse}, rotate_det_elapse={rotate_det_elapse}" |
| 145 | +) |
| 146 | +# 一张图片中可能有多个表格 |
| 147 | +# img = img_loader(img_path) |
| 148 | +# file_name_with_ext = os.path.basename(img_path) |
| 149 | +# file_name, file_ext = os.path.splitext(file_name_with_ext) |
| 150 | +# out_dir = "rapid_table_det_paddle/outputs" |
| 151 | +# if not os.path.exists(out_dir): |
| 152 | +# os.makedirs(out_dir) |
| 153 | +# extract_img = img.copy() |
| 154 | +# for i, res in enumerate(result): |
| 155 | +# box = res["box"] |
| 156 | +# lt, rt, rb, lb = res["lt"], res["rt"], res["rb"], res["lb"] |
| 157 | +# # 带识别框和左上角方向位置 |
| 158 | +# img = visuallize(img, box, lt, rt, rb, lb) |
| 159 | +# # 透视变换提取表格图片 |
| 160 | +# wrapped_img = extract_table_img(extract_img.copy(), lt, rt, rb, lb) |
| 161 | +# cv2.imwrite(f"{out_dir}/{file_name}-extract-{i}.jpg", wrapped_img) |
| 162 | +# cv2.imwrite(f"{out_dir}/{file_name}-visualize.jpg", img) |
| 163 | + |
119 | 164 | ``` |
120 | 165 |
|
121 | 166 | ## FAQ (Frequently Asked Questions) |
|
0 commit comments