Tingquan commited on
Commit
920cf1b
·
verified ·
1 Parent(s): ee42e57

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +121 -0
README.md ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ ---
4
+
5
+ # UVDoc
6
+
7
+ ## Introduction
8
+
9
+ The main purpose of text image correction is to carry out geometric transformation on the image to correct the document distortion, inclination, perspective deformation and other problems in the image, so that the subsequent text recognition can be more accurate.
10
+
11
+ | Model| CER |
12
+ | --- | --- |
13
+ |UVDoc | 0.179 |
14
+
15
+ **Note**: Test data set: docunet benchmark data set.
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 text_image_unwarping --model_name UVDoc -i https://cdn-uploads.huggingface.co/production/uploads/63d7b8ee07cd1aa3c49a2026/SfMVKd0xnMII5KBDV6Mfz.jpeg
52
+ ```
53
+
54
+ You can also integrate the model inference of the TextImageUnwarping 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 TextImageUnwarping
58
+
59
+ model = TextImageUnwarping(model_name="UVDoc")
60
+ output = model.predict("SfMVKd0xnMII5KBDV6Mfz.jpeg", batch_size=1)
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': 'doc_test.jpg', 'page_index': None, 'doctr_img': '...'}}
71
+ ```
72
+
73
+ The visualized image is as follows:
74
+
75
+ ![image/jpeg](https://cdn-uploads.huggingface.co/production/uploads/63d7b8ee07cd1aa3c49a2026/1405yNIYq_hA9VL3_8Itn.jpeg)
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/text_image_unwarping.html#iii-quick-integration).
78
+
79
+
80
+ ### Pipeline Usage
81
+
82
+ The ability of a single model is limited. But the pipeline consists of several models can provide more capacity to resolve difficult problems in real-world scenarios.
83
+
84
+
85
+ #### PP-StructureV3
86
+
87
+ Layout analysis is a technique used to extract structured information from document images. PP-StructureV3 includes the following six modules:
88
+ * Layout Detection Module
89
+ * General OCR Sub-pipeline
90
+ * Document Image Preprocessing Sub-pipeline (Optional)
91
+ * Table Recognition Sub-pipeline (Optional)
92
+ * Seal Recognition Sub-pipeline (Optional)
93
+ * Formula Recognition Sub-pipeline (Optional)
94
+
95
+ You can quickly experience the PP-StructureV3 pipeline with a single command.
96
+
97
+ ```bash
98
+ paddleocr pp_structurev3 --use_doc_unwarping True -i https://cdn-uploads.huggingface.co/production/uploads/63d7b8ee07cd1aa3c49a2026/KP10tiSZfAjMuwZUSLtRp.png
99
+ ```
100
+
101
+ You can experience the inference of the pipeline with just a few lines of code. Taking the PP-StructureV3 pipeline as an example:
102
+
103
+ ```python
104
+ from paddleocr import PPStructureV3
105
+
106
+ pipeline = PPStructureV3(use_doc_unwarping=True) # Use use_doc_unwarping to enable/disable document unwarping module
107
+ output = pipeline.predict("./KP10tiSZfAjMuwZUSLtRp.png")
108
+ for res in output:
109
+ res.print() ## Print the structured prediction output
110
+ res.save_to_json(save_path="output") ## Save the current image's structured result in JSON format
111
+ res.save_to_markdown(save_path="output") ## Save the current image's result in Markdown format
112
+ ```
113
+
114
+ For details about usage command and descriptions of parameters, please refer to the [Document](https://paddlepaddle.github.io/PaddleOCR/latest/en/version3.x/pipeline_usage/PP-StructureV3.html#2-quick-start).
115
+
116
+ ## Links
117
+
118
+ [PaddleOCR Repo](https://github.com/paddlepaddle/paddleocr)
119
+
120
+ [PaddleOCR Documentation](https://paddlepaddle.github.io/PaddleOCR/latest/en/index.html)
121
+