diff --git a/README.md b/README.md index 0db38a2..2581cd9 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ ## Rapid Structure - 该部分的功能主要针对文档类图像,包括文档图像分类、版面分析和表格识别。 -### [版面分析](https://github.com/RapidAI/RapidOCR/blob/main/python/rapid_structure/docs/README_Layout.md) +### [版面分析](./docs/README_Layout.md) -### [表格识别](https://github.com/RapidAI/RapidOCR/blob/main/python/rapid_structure/docs/README_Table.md) +### [表格识别](./docs/README_Table.md) -### [文档方向分类](https://github.com/RapidAI/RapidOCR/blob/main/python/rapid_structure/docs/README_Orientation.md) +### [文档方向分类](./docs/README_Orientation.md) -### 整体结构 +### 整体流程 ```mermaid flowchart LR A[/文档图像/] --> B(文档方向分类 rapid_orientation) --> C(版面分析 rapid_layout) & D(表格识别 rapid_table) --> E(OCR识别 rapidocr_onnxruntime) diff --git a/docs/doc_whl_rapid_layout.md b/docs/doc_whl_rapid_layout.md new file mode 100644 index 0000000..29f40cf --- /dev/null +++ b/docs/doc_whl_rapid_layout.md @@ -0,0 +1,60 @@ +## rapid-layout Package +

+ + + PyPI +

+ +### 1. Install package by pypi. +```bash +$ pip install rapid-layout +``` + +### 2. Run by script. +- RapidLayout has the default `model_path` value, you can set the different value of `model_path` to use different models, e.g. `layout_engine = RapidLayout(model_path='layout_publaynet.onnx')` +- See details, for [README_Layout](https://github.com/RapidAI/RapidOCR/blob/f133ff008a1c60edd6e0ed882da83873aa7b113a/python/rapid_structure/docs/README_Layout.md) . +- 📌 `layout.png` source: [link](https://github.com/RapidAI/RapidOCR/blob/f133ff008a1c60edd6e0ed882da83873aa7b113a/python/rapid_structure/test_images/layout.png) + +```python +import cv2 +from rapid_layout import RapidLayout + +layout_engine = RapidLayout() + +img = cv2.imread('layout.png') + +layout_res, elapse = layout_engine(img) +print(layout_res) +``` + +### 3. Run by command line. +- Usage: + ```bash + $ rapid_layout -h + usage: rapid_layout [-h] [-v] -img IMG_PATH [-m MODEL_PATH] + + optional arguments: + -h, --help show this help message and exit + -v, --vis Wheter to visualize the layout results. + -img IMG_PATH, --img_path IMG_PATH + Path to image for layout. + -m MODEL_PATH, --model_path MODEL_PATH + The model path used for inference. + ``` +- Example: + ```bash + $ rapid_layout -v -img layout.png + ``` + +### 4. Result. +- Return value. + ```python + [ + {'bbox': array([321.4160495, 91.53214898, 562.06141263, 199.85522603]), 'label': 'text'}, + {'bbox': array([58.67292211, 107.29000663, 300.25448676, 199.68142]), 'label': 'table_caption'} + ] + ``` +- Visualize result. +
+ +
diff --git a/docs/doc_whl_rapid_orientation.md b/docs/doc_whl_rapid_orientation.md new file mode 100644 index 0000000..dd751ed --- /dev/null +++ b/docs/doc_whl_rapid_orientation.md @@ -0,0 +1,51 @@ +## rapid-orientation Package +

+ + + PyPI +

+ +### 1. Install package by pypi. +```bash +$ pip install rapid-orientation +``` + +### 2. Run by script. +- RapidOrientation has the default `model_path` value, you can set the different value of `model_path` to use different models, e.g. `orientation_engine = RapidOrientation(model_path='rapid_orientation.onnx')` +- See details, for [README_Layout](https://github.com/RapidAI/RapidOCR/blob/f133ff008a1c60edd6e0ed882da83873aa7b113a/python/rapid_structure/docs/README_Layout.md) . +- 📌 `layout.png` source: [link](https://github.com/RapidAI/RapidOCR/blob/f133ff008a1c60edd6e0ed882da83873aa7b113a/python/rapid_structure/test_images/layout.png) + +```python +import cv2 +from rapid_orientation import RapidOrientation + +orientation_engine = RapidOrientation() + +img = cv2.imread('test_images/layout.png') + +orientation_res, elapse = orientation_engine(img) +print(orientation_res) +``` + +### 3. Run by command line. +- Usage: + ```bash + $ rapid_orientation -h + usage: rapid_orientation [-h] -img IMG_PATH [-m MODEL_PATH] + + optional arguments: + -h, --help show this help message and exit + -img IMG_PATH, --img_path IMG_PATH + Path to image for layout. + -m MODEL_PATH, --model_path MODEL_PATH + The model path used for inference + ``` +- Example: + ```bash + $ rapid_orientation -img layout.png + ``` + +### 4. Result. +```python +# Return str, four types::0 | 90 | 180 | 270 +``` \ No newline at end of file diff --git a/docs/doc_whl_rapid_table.md b/docs/doc_whl_rapid_table.md new file mode 100644 index 0000000..6534b24 --- /dev/null +++ b/docs/doc_whl_rapid_table.md @@ -0,0 +1,41 @@ +## rapid-table Package +

+ + +

+ +### 1. Install package by pypi. +```bash +$ pip install rapid-table +``` + +### 2. Run by script. +- RapidTable has the default `model_path` value, you can set the different value of `model_path` to use different models, e.g. `table_engine = RapidTable(model_path='ch_ppstructure_mobile_v2_SLANet.onnx')` +- See details, for [README_Table](https://github.com/RapidAI/RapidOCR/blob/a87133a6fc3b8ee696e246028e529f7b2319d138/python/rapid_structure/docs/README_Table.md) . +- 📌 `table.jpg` source: [link](https://github.com/RapidAI/RapidOCR/blob/a87133a6fc3b8ee696e246028e529f7b2319d138/python/rapid_structure/test_images/table.jpg) + +```python +import cv2 +from rapid_table import RapidTable + +table_engine = RapidTable() + +img = cv2.imread('table.jpg') +table_html_str, _ = table_engine(img) +print(table_html_str) +``` + +### 3. Run by command line. +```bash +$ rapid_table -v -img table.jpg +``` + +### 4. Result. +- Return value. + ```html + <>
MethodsFPS
SegLink [26]70.086d>77.08.9
PixelLink [4]73.283.077.8
TextSnake [18]73.983.278.31.1
TextField [37]75.987.481.35.2
MSR[38]76.787.87.481.7
FTSN [3]77.187.682.0
LSE[30]81.784.282.9
CRAFT [2]78.288.282.98.6
MCN[16]798883
ATRR[35]82.185.283.6
PAN [34]83.884.484.130.2
DB[12]79.291.584.932.0
DRRG[41]82.3088.0585.08
Ours (SynText)80.688582.9712.68
Ours (MLT-17)84.5486.6285.5712.31
+ ``` +- Visualize result. +
+ <>
MethodsFPS
SegLink [26]70.086d>77.08.9
PixelLink [4]73.283.077.8
TextSnake [18]73.983.278.31.1
TextField [37]75.987.481.35.2
MSR[38]76.787.87.481.7
FTSN [3]77.187.682.0
LSE[30]81.784.282.9
CRAFT [2]78.288.282.98.6
MCN[16]798883
ATRR[35]82.185.283.6
PAN [34]83.884.484.130.2
DB[12]79.291.584.932.0
DRRG[41]82.3088.0585.08
Ours (SynText)80.688582.9712.68
Ours (MLT-17)84.5486.6285.5712.31
+