Tingquan commited on
Commit
629910b
·
verified ·
1 Parent(s): 7575699

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +101 -0
README.md ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ ---
4
+
5
+ # PP-LCNet_x0_25_textline_ori
6
+
7
+ ## Introduction
8
+
9
+ The text line orientation classification module primarily distinguishes the orientation of text lines and corrects them using post-processing. In processes such as document scanning and license/certificate photography, to capture clearer images, the capture device may be rotated, resulting in text lines in various orientations. Standard OCR pipelines cannot handle such data well. By utilizing image classification technology, the orientation of text lines can be predetermined and adjusted, thereby enhancing the accuracy of OCR processing. The key accuracy metrics are as follow:
10
+
11
+ <table>
12
+ <tr>
13
+ <th>Model</th>
14
+ <th>Recognition Avg Accuracy(%)</th>
15
+ <th>GPU Inference Time (ms)<br/>[Normal Mode / High-Performance Mode]</th>
16
+ <th>CPU Inference Time (ms)<br/>[Normal Mode / High-Performance Mode]</th>
17
+ <th>Model Storage Size (M)</th>
18
+ <th>Introduction</th>
19
+ </tr>
20
+ <tr>
21
+ <td>PP-LCNet_x0_25_textline_ori</td>
22
+ <td>98.85</td>
23
+ <td>-</td>
24
+ <td>-</td>
25
+ <td>0.96</td>
26
+ <td>Text line classification model based on PP-LCNet_x0_25, with two classes: 0 degrees and 180 degrees</td>
27
+ </tr>
28
+ </table>
29
+
30
+
31
+ **Note**: If any character (including punctuation) in a line is incorrect, the entire line is marked as wrong. This ensures higher accuracy in practical applications.
32
+
33
+ ## Quick Start
34
+
35
+ ### Installation
36
+
37
+ 1. PaddlePaddle
38
+
39
+ Please refer to the following commands to install PaddlePaddle using pip:
40
+
41
+ ```bash
42
+ # for CUDA11.8
43
+ python -m pip install paddlepaddle-gpu==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/
44
+
45
+ # for CUDA12.6
46
+ python -m pip install paddlepaddle-gpu==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu126/
47
+
48
+ # for CPU
49
+ python -m pip install paddlepaddle==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/
50
+ ```
51
+
52
+ For details about PaddlePaddle installation, please refer to the [PaddlePaddle official website](https://www.paddlepaddle.org.cn/en/install/quick).
53
+
54
+ 2. PaddleOCR
55
+
56
+ Install the latest version of the PaddleOCR inference package from PyPI:
57
+
58
+ ```bash
59
+ python -m pip install paddleocr
60
+ ```
61
+
62
+ ### Model Usage
63
+
64
+ You can quickly experience the functionality with a single command:
65
+
66
+ ```bash
67
+ paddleocr text_line_orientation_classification \
68
+ --model_name PP-LCNet_x0_25_textline_ori \
69
+ -i https://cdn-uploads.huggingface.co/production/uploads/681c1ecd9539bdde5ae1733c/m3ZmUPAnst1f9xXvTVLKS.png
70
+ ```
71
+
72
+ You can also integrate the model inference of the text recognition module into your project. Before running the following code, please download the sample image to your local machine.
73
+
74
+ ```python
75
+ from paddleocr import TextLineOrientationClassificatio
76
+ model = TextLineOrientationClassification(model_name="PP-LCNet_x0_25_textline_ori")
77
+ output = model.predict(input="m3ZmUPAnst1f9xXvTVLKS.png", batch_size=1)
78
+ for res in output:
79
+ res.print()
80
+ res.save_to_img(save_path="./output/")
81
+ res.save_to_json(save_path="./output/res.json")
82
+ ```
83
+
84
+ After running, the obtained result is as follows:
85
+
86
+ ```json
87
+ {'res': {'input_path': '/root/.paddlex/predict_input/m3ZmUPAnst1f9xXvTVLKS.png', 'page_index': None, 'class_ids': array([1], dtype=int32), 'scores': array([0.99671], dtype=float32), 'label_names': ['180_degree']}}
88
+ ```
89
+
90
+ The visualized image is as follows:
91
+
92
+ ![image/jpeg](https://cdn-uploads.huggingface.co/production/uploads/681c1ecd9539bdde5ae1733c/0y5rEbMTzgsqP6Ptnj-Er.png)
93
+
94
+ 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_recognition.html#iii-quick-start).
95
+
96
+
97
+ ## Links
98
+
99
+ [PaddleOCR Repo](https://github.com/paddlepaddle/paddleocr)
100
+
101
+ [PaddleOCR Documentation](https://paddlepaddle.github.io/PaddleOCR/latest/en/index.html)