Skip to content

Commit 580fb8b

Browse files
committed
docs: readme update
1 parent d2706fe commit 580fb8b

File tree

2 files changed

+105
-35
lines changed

2 files changed

+105
-35
lines changed

README.md

Lines changed: 53 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,63 @@
1616

1717
### Introduction
1818

19-
This repo is an inference library used for structured recognition of tables in documents, including table structure recognition algorithm models from PaddleOCR, wired and wireless table recognition algorithm models from Alibaba Duguang, etc.
19+
This repository is a library for structured recognition of tables in documents.
20+
It includes table recognition models from Paddle, Alibaba's DocLight wired and wireless table recognition models,
21+
wired table models contributed by others, and the built-in table classification model from NetEase QAnything.
2022

21-
The repo has improved the pre- and post-processing of form recognition and combined with OCR to ensure that the form recognition part can be used directly.
2223

23-
The repo will continue to focus on the field of table recognition, integrate the latest and most useful table recognition algorithms, and strive to create the most valuable table recognition tool library.
2424

25-
Welcome everyone to continue to pay attention.
25+
#### Features
26+
**Fast**: Uses ONNXRuntime as the inference engine, achieving 1-7 second inference times on CPU.
2627

27-
### What is Table Structure Recognition?
28+
🎯 **Accurate**: Combines table type classification models to distinguish between wired and wireless tables, leading to more specialized tasks and higher accuracy.
2829

29-
Table Structure Recognition (TSR) aims to extract the logical or physical structure of table images, thereby converting unstructured table images into machine-readable formats.
30+
🛡️ **Stable**: Does not depend on any third-party training frameworks, uses specialized ONNX models, and completely solves memory leak issues.
3031

31-
Logical structure: represents the row/column relationship of cells (such as the same row, the same column) and the span information of cells.
32-
33-
Physical structure: includes not only the logical structure, but also the cell's bounding box, content and other information, emphasizing the physical location of the cell.
34-
35-
<div align='center'>
36-
<img src="https://github.com/RapidAI/TableStructureRec/releases/download/v0.0.0/TSRFramework.jpg" width=70%>
32+
### Results Demonstration
33+
<div align="center">
34+
<img src="https://github.com/RapidAI/TableStructureRec/releases/download/v0.0.0/demo_img_output.gif" alt="Demo" width="100%" height="100%">
3735
</div>
3836

39-
Figure from: [Improving Table Structure Recognition with Visual-Alignment Sequential Coordinate Modeling](https://openaccess.thecvf.com/content/CVPR2023/html/Huang_Improving_Table_Structure_Recognition_With_Visual-Alignment_Sequential_Coordinate_Modeling_CVPR_2023_paper.html)
40-
41-
### Documentation
42-
43-
Full documentation can be found on [docs](https://rapidai.github.io/TableStructureRec/docs/), in Chinese.
37+
### Install
38+
``` python {linenos=table}
39+
pip install wired_table_rec lineless_table_rec table_cls
40+
```
41+
42+
### Quick Start
43+
``` python {linenos=table}
44+
import os
45+
46+
from lineless_table_rec import LinelessTableRecognition
47+
from lineless_table_rec.utils_table_recover import format_html, plot_rec_box_with_logic_info, plot_rec_box
48+
from table_cls import TableCls
49+
from wired_table_rec import WiredTableRecognition
50+
51+
lineless_engine = LinelessTableRecognition()
52+
wired_engine = WiredTableRecognition()
53+
table_cls = TableCls()
54+
img_path = f'images/img14.jpg'
55+
56+
cls,elasp = table_cls(img_path)
57+
if cls == 'wired':
58+
table_engine = wired_engine
59+
else:
60+
table_engine = lineless_engine
61+
html, elasp, polygons, logic_points, ocr_res = table_engine(img_path)
62+
print(f"elasp: {elasp}")
63+
64+
# output_dir = f'outputs'
65+
# complete_html = format_html(html)
66+
# os.makedirs(os.path.dirname(f"{output_dir}/table.html"), exist_ok=True)
67+
# with open(f"{output_dir}/table.html", "w", encoding="utf-8") as file:
68+
# file.write(complete_html)
69+
# # 可视化表格识别框 + 逻辑行列信息
70+
# plot_rec_box_with_logic_info(
71+
# img_path, f"{output_dir}/table_rec_box.jpg", logic_points, polygons
72+
# )
73+
# # 可视化 ocr 识别框
74+
# plot_rec_box(img_path, f"{output_dir}/ocr_box.jpg", ocr_res)
75+
```
4476

4577
### Acknowledgements
4678

@@ -50,6 +82,10 @@ Full documentation can be found on [docs](https://rapidai.github.io/TableStructu
5082

5183
[LORE](https://www.modelscope.cn/models/damo/cv_resnet-transformer_table-structure-recognition_lore/summary)
5284

85+
[Qanything-RAG](https://github.com/netease-youdao/QAnything)
86+
87+
llaipython (WeChat, commercial support for table extraction) provides high-precision wired table models.
88+
5389
### Contributing
5490

5591
Pull requests are welcome. For major changes, please open an issue first

docs/README_zh.md

Lines changed: 52 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,61 @@
1616

1717
### 简介
1818

19-
该仓库是用来对文档中表格做结构化识别的推理库,包括来自PaddleOCR的表格结构识别算法模型、来自阿里读光有线和无线表格识别算法模型等。
19+
💖该仓库是用来对文档中表格做结构化识别的推理库,包括来自paddle的表格识别模型,
20+
阿里读光有线和无线表格识别模型,其他人贡献的有线表格模型,网易Qanything内置表格分类模型等。
2021

21-
该仓库将表格识别前后处理做了完善,并结合OCR,保证表格识别部分可直接使用。
22+
#### 特点
23+
**** 采用ONNXRuntime作为推理引擎,cpu下单图推理1-7s
2224

23-
该仓库会持续关注表格识别这一领域,集成最新最好用的表格识别算法,争取打造最具有落地价值的表格识别工具库。
25+
🎯 ****: 结合表格类型分类模型,区分有线表格,无线表格,任务更细分,精度更高
2426

25-
欢迎大家持续关注。
27+
🛡️ ****: 不依赖任何第三方训练框架,采用onnx专项小模型, 彻底解决了内存泄露问题
2628

27-
### 表格结构化识别
2829

29-
表格结构识别(Table Structure Recognition, TSR)旨在提取表格图像的逻辑或物理结构,从而将非结构化的表格图像转换为机器可读的格式。
30-
31-
逻辑结构:表示单元格的行/列关系(例如同行、同列)和单元格的跨度信息。
32-
33-
物理结构:不仅包含逻辑结构,还包含单元格的包围框、内容等信息,强调单元格的物理位置。
34-
35-
<div align='center'>
36-
<img src="https://github.com/RapidAI/TableStructureRec/releases/download/v0.0.0/TSRFramework.jpg" width=70%>
30+
### 效果展示
31+
<div align="center">
32+
<img src="https://github.com/RapidAI/TableStructureRec/releases/download/v0.0.0/demo_img_output.gif" alt="Demo" width="100%" height="100%">
3733
</div>
3834

39-
图来自: [Improving Table Structure Recognition with Visual-Alignment Sequential Coordinate Modeling](https://openaccess.thecvf.com/content/CVPR2023/html/Huang_Improving_Table_Structure_Recognition_With_Visual-Alignment_Sequential_Coordinate_Modeling_CVPR_2023_paper.html)
40-
41-
### 文档
42-
43-
完整文档请移步:[docs](https://rapidai.github.io/TableStructureRec/docs/)
35+
### 安装
36+
``` python {linenos=table}
37+
pip install wired_table_rec lineless_table_rec table_cls
38+
```
39+
40+
### 快速使用
41+
``` python {linenos=table}
42+
import os
43+
44+
from lineless_table_rec import LinelessTableRecognition
45+
from lineless_table_rec.utils_table_recover import format_html, plot_rec_box_with_logic_info, plot_rec_box
46+
from table_cls import TableCls
47+
from wired_table_rec import WiredTableRecognition
48+
49+
lineless_engine = LinelessTableRecognition()
50+
wired_engine = WiredTableRecognition()
51+
table_cls = TableCls()
52+
img_path = f'images/img14.jpg'
53+
54+
cls,elasp = table_cls(img_path)
55+
if cls == 'wired':
56+
table_engine = wired_engine
57+
else:
58+
table_engine = lineless_engine
59+
html, elasp, polygons, logic_points, ocr_res = table_engine(img_path)
60+
print(f"elasp: {elasp}")
61+
62+
# output_dir = f'outputs'
63+
# complete_html = format_html(html)
64+
# os.makedirs(os.path.dirname(f"{output_dir}/table.html"), exist_ok=True)
65+
# with open(f"{output_dir}/table.html", "w", encoding="utf-8") as file:
66+
# file.write(complete_html)
67+
# # 可视化表格识别框 + 逻辑行列信息
68+
# plot_rec_box_with_logic_info(
69+
# img_path, f"{output_dir}/table_rec_box.jpg", logic_points, polygons
70+
# )
71+
# # 可视化 ocr 识别框
72+
# plot_rec_box(img_path, f"{output_dir}/ocr_box.jpg", ocr_res)
73+
```
4474

4575
### 致谢
4676

@@ -50,6 +80,10 @@
5080

5181
[读光-表格结构识别-无线表格](https://www.modelscope.cn/models/damo/cv_resnet-transformer_table-structure-recognition_lore/summary)
5282

83+
[Qanything-RAG](https://github.com/netease-youdao/QAnything)
84+
85+
llaipython(微信,商业化支持表格提取) 提供高精度有线表格模型。
86+
5387
### 贡献指南
5488

5589
欢迎提交请求。对于重大更改,请先打开issue讨论您想要改变的内容。

0 commit comments

Comments
 (0)