|
10 | 10 | pip install paddleocr
|
11 | 11 | ```
|
12 | 12 |
|
13 |
| -### Use |
| 13 | +### Use by code |
14 | 14 |
|
15 | 15 | === "Detection + Classification + Recognition"
|
16 | 16 |
|
@@ -169,6 +169,101 @@ pip install paddleocr
|
169 | 169 | ['0', 0.99999964]
|
170 | 170 | ```
|
171 | 171 |
|
| 172 | +### Usy by command line |
| 173 | + |
| 174 | +Show help information |
| 175 | + |
| 176 | +```bash linenums="1" |
| 177 | +paddleocr -h |
| 178 | +``` |
| 179 | + |
| 180 | +=== "Detection + Classification + Recognition" |
| 181 | + |
| 182 | + ```bash linenums="1" |
| 183 | + paddleocr --image_dir PaddleOCR/doc/imgs_en/img_12.jpg --use_angle_cls true --lang en |
| 184 | + ``` |
| 185 | + |
| 186 | + Output will be a list, each item contains bounding box, text and recognition confidence |
| 187 | + |
| 188 | + ```python linenums="1" |
| 189 | + [[[442.0, 173.0], [1169.0, 173.0], [1169.0, 225.0], [442.0, 225.0]], ['ACKNOWLEDGEMENTS', 0.99283075]] |
| 190 | + [[[393.0, 340.0], [1207.0, 342.0], [1207.0, 389.0], [393.0, 387.0]], ['We would like to thank all the designers and', 0.9357758]] |
| 191 | + [[[399.0, 398.0], [1204.0, 398.0], [1204.0, 433.0], [399.0, 433.0]], ['contributors whohave been involved in the', 0.9592447]] |
| 192 | + ...... |
| 193 | + ``` |
| 194 | + |
| 195 | + pdf file is also supported, you can infer the first few pages by using the page_num parameter, the default is 0, which means infer all pages |
| 196 | + |
| 197 | + ```bash linenums="1" |
| 198 | + paddleocr --image_dir ./xxx.pdf --use_angle_cls true --use_gpu false --page_num 2 |
| 199 | + ``` |
| 200 | + |
| 201 | +=== "Detection + Recognition" |
| 202 | + |
| 203 | + ```bash linenums="1" |
| 204 | + paddleocr --image_dir PaddleOCR/doc/imgs_en/img_12.jpg --lang en |
| 205 | + ``` |
| 206 | + |
| 207 | + Output will be a list, each item contains bounding box, text and recognition confidence |
| 208 | + |
| 209 | + ```python linenums="1" |
| 210 | + [[[442.0, 173.0], [1169.0, 173.0], [1169.0, 225.0], [442.0, 225.0]], ['ACKNOWLEDGEMENTS', 0.99283075]] |
| 211 | + [[[393.0, 340.0], [1207.0, 342.0], [1207.0, 389.0], [393.0, 387.0]], ['We would like to thank all the designers and', 0.9357758]] |
| 212 | + [[[399.0, 398.0], [1204.0, 398.0], [1204.0, 433.0], [399.0, 433.0]], ['contributors whohave been involved in the', 0.9592447]] |
| 213 | + ...... |
| 214 | + ``` |
| 215 | + |
| 216 | +=== "Classification + Recognition" |
| 217 | + |
| 218 | + ```bash linenums="1" |
| 219 | + paddleocr --image_dir PaddleOCR/doc/imgs_words_en/word_10.png --use_angle_cls true --det false --lang en |
| 220 | + ``` |
| 221 | + |
| 222 | + Output will be a list, each item contains text and recognition confidence |
| 223 | + |
| 224 | + ```python linenums="1" |
| 225 | + ['PAIN', 0.990372] |
| 226 | + ``` |
| 227 | + |
| 228 | +=== "Only detection" |
| 229 | + |
| 230 | + ```bash linenums="1" |
| 231 | + paddleocr --image_dir PaddleOCR/doc/imgs_en/img_12.jpg --rec false |
| 232 | + ``` |
| 233 | + |
| 234 | + Output will be a list, each item only contains bounding box |
| 235 | + |
| 236 | + ```python linenums="1" |
| 237 | + [[756.0, 812.0], [805.0, 812.0], [805.0, 830.0], [756.0, 830.0]] |
| 238 | + [[820.0, 803.0], [1085.0, 801.0], [1085.0, 836.0], [820.0, 838.0]] |
| 239 | + [[393.0, 801.0], [715.0, 805.0], [715.0, 839.0], [393.0, 836.0]] |
| 240 | + ...... |
| 241 | + ``` |
| 242 | + |
| 243 | +=== "Only recognition" |
| 244 | + |
| 245 | + ```bash linenums="1" |
| 246 | + paddleocr --image_dir PaddleOCR/doc/imgs_words_en/word_10.png --det false --lang en |
| 247 | + ``` |
| 248 | + |
| 249 | + Output will be a list, each item contains text and recognition confidence |
| 250 | + |
| 251 | + ```python linenums="1" |
| 252 | + ['PAIN', 0.990372] |
| 253 | + ``` |
| 254 | + |
| 255 | +=== "Only classification" |
| 256 | + |
| 257 | + ```bash linenums="1" |
| 258 | + paddleocr --image_dir PaddleOCR/doc/imgs_words_en/word_10.png --use_angle_cls true --det false --rec false |
| 259 | + ``` |
| 260 | + |
| 261 | + Output will be a list, each item contains classification result and confidence |
| 262 | + |
| 263 | + ```python linenums="1" |
| 264 | + ['0', 0.99999964] |
| 265 | + ``` |
| 266 | + |
172 | 267 | ### Online Demo
|
173 | 268 |
|
174 | 269 | - PP-OCRv4 online experience:<https://aistudio.baidu.com/aistudio/projectdetail/6611435>
|
|
0 commit comments