Instructions to use PaddlePaddle/PP-DocBlockLayout_onnx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PaddleOCR
How to use PaddlePaddle/PP-DocBlockLayout_onnx with PaddleOCR:
# 1. See https://www.paddlepaddle.org.cn/en/install to install paddlepaddle # 2. pip install paddleocr from paddleocr import LayoutDetection model = LayoutDetection(model_name="PP-DocBlockLayout_onnx") output = model.predict(input="path/to/image.png", batch_size=1) for res in output: res.print() res.save_to_img(save_path="./output/") res.save_to_json(save_path="./output/res.json") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,3 +1,56 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
library_name: PaddleOCR
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
- zh
|
| 7 |
+
pipeline_tag: image-to-text
|
| 8 |
+
tags:
|
| 9 |
+
- OCR
|
| 10 |
+
- PaddlePaddle
|
| 11 |
+
- PaddleOCR
|
| 12 |
+
- layout_detection
|
| 13 |
---
|
| 14 |
+
|
| 15 |
+
# PP-DocBlockLayout
|
| 16 |
+
|
| 17 |
+
## Introduction
|
| 18 |
+
|
| 19 |
+
A layout block localization model trained on a self-built dataset containing Chinese and English papers, PPT, multi-layout magazines, contracts, books, exams, ancient books and research reports using RT-DETR-L. The layout detection model includes 1 category: Region.
|
| 20 |
+
|
| 21 |
+
| Model| mAP(0.5) (%) |
|
| 22 |
+
| --- | --- |
|
| 23 |
+
|PP-DocBlockLayout | 95.9 |
|
| 24 |
+
|
| 25 |
+
**Note**: the evaluation set of the above precision indicators is the self built version sub area detection data set, including Chinese and English papers, magazines, newspapers, research reports PPT、 1000 document type pictures such as test papers and textbooks.
|
| 26 |
+
|
| 27 |
+
## Model Usage
|
| 28 |
+
|
| 29 |
+
### Install Dependencies
|
| 30 |
+
|
| 31 |
+
```shell
|
| 32 |
+
pip install -U paddleocr
|
| 33 |
+
pip install -U onnxruntime-gpu
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
### CLI Usage
|
| 37 |
+
|
| 38 |
+
```shell
|
| 39 |
+
paddleocr layout_detection -i ./demo.jpg --model_name PP-DocBlockLayout --engine onnxruntime
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
### Python API Usage
|
| 43 |
+
|
| 44 |
+
```python
|
| 45 |
+
from paddleocr import LayoutDetection
|
| 46 |
+
|
| 47 |
+
model = LayoutDetection(
|
| 48 |
+
model_name="PP-DocBlockLayout",
|
| 49 |
+
engine="onnxruntime",
|
| 50 |
+
)
|
| 51 |
+
output = model.predict("./demo.jpg", batch_size=1)
|
| 52 |
+
for res in output:
|
| 53 |
+
res.print()
|
| 54 |
+
res.save_to_img(save_path="./output/")
|
| 55 |
+
res.save_to_json(save_path="./output/res.json")
|
| 56 |
+
```
|