Tingquan commited on
Commit
4dbe24b
·
verified ·
1 Parent(s): f5657c4

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +85 -0
README.md ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ ---
4
+
5
+ # PP-DocBlockLayout
6
+
7
+ ## Introduction
8
+
9
+ 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.
10
+
11
+ | Model| mAP(0.5) (%) |
12
+ | --- | --- |
13
+ |PP-DocBlockLayout | 95.9 |
14
+
15
+ **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.
16
+
17
+ ## Quick Start
18
+
19
+ ### Installation
20
+
21
+ 1. PaddlePaddle
22
+
23
+ Please refer to the following commands to install PaddlePaddle using pip:
24
+
25
+ ```bash
26
+ # for CUDA11.8
27
+ python -m pip install paddlepaddle-gpu==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/
28
+
29
+ # for CUDA12.6
30
+ python -m pip install paddlepaddle-gpu==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu126/
31
+
32
+ # for CPU
33
+ python -m pip install paddlepaddle==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/
34
+ ```
35
+
36
+ For details about PaddlePaddle installation, please refer to the [PaddlePaddle official website](https://www.paddlepaddle.org.cn/en/install/quick).
37
+
38
+ 2. PaddleOCR
39
+
40
+ Install the latest version of the PaddleOCR inference package from PyPI:
41
+
42
+ ```bash
43
+ python -m pip install paddleocr
44
+ ```
45
+
46
+ ### Model Usage
47
+
48
+ You can quickly experience the functionality with a single command:
49
+
50
+ ```bash
51
+ paddleocr layout_detection --model_name PP-DocBlockLayout -i https://cdn-uploads.huggingface.co/production/uploads/63d7b8ee07cd1aa3c49a2026/SCL4KLVcaUKkinua_bTec.png
52
+ ```
53
+
54
+ You can also integrate the model inference of the LayoutDetection module into your project. Before running the following code, please download the sample image to your local machine.
55
+
56
+ ```python
57
+ from paddleocr import LayoutDetection
58
+
59
+ model = LayoutDetection(model_name="PP-DocBlockLayout")
60
+ output = model.predict("SCL4KLVcaUKkinua_bTec.png", batch_size=1, layout_nms=True)
61
+ for res in output:
62
+ res.print()
63
+ res.save_to_img(save_path="./output/")
64
+ res.save_to_json(save_path="./output/res.json")
65
+ ```
66
+
67
+ After running, the obtained result is as follows:
68
+
69
+ ```json
70
+ {'res': {'input_path': '/root/.paddlex/predict_input/SCL4KLVcaUKkinua_bTec.png', 'page_index': None, 'boxes': [{'cls_id': 0, 'label': 'Region', 'score': 0.9768685698509216, 'coordinate': [31.313992, 298.04843, 479.92798, 1994.14]}, {'cls_id': 0, 'label': 'Region', 'score': 0.9728955626487732, 'coordinate': [648.478, 1233.5554, 1552.8765, 1992.712]}, {'cls_id': 0, 'label': 'Region', 'score': 0.9725626707077026, 'coordinate': [647.51337, 295.63956, 1550.7095, 1181.5878]}, {'cls_id': 0, 'label': 'Region', 'score': 0.9079533219337463, 'coordinate': [644.75916, 59.31064, 1468.8861, 264.68124]}, {'cls_id': 0, 'label': 'Region', 'score': 0.8413463234901428, 'coordinate': [31.890125, 60.103912, 470.73123, 284.72952]}]}}
71
+ ```
72
+
73
+ The visualized image is as follows:
74
+
75
+ ![image/jpeg](https://cdn-uploads.huggingface.co/production/uploads/63d7b8ee07cd1aa3c49a2026/Oh3-zU4R3wnkmvX-cY4Tz.png)
76
+
77
+ For details about usage command and descriptions of parameters, please refer to the [Document](https://paddlepaddle.github.io/PaddleOCR/latest/en/version3.x/module_usage/layout_detection.html#iii-quick-integration).
78
+
79
+
80
+ ## Links
81
+
82
+ [PaddleOCR Repo](https://github.com/paddlepaddle/paddleocr)
83
+
84
+ [PaddleOCR Documentation](https://paddlepaddle.github.io/PaddleOCR/latest/en/index.html)
85
+