whl_en.md 24.6 KB
Newer Older
qq_25193841's avatar
qq_25193841 已提交
1
# Paddleocr Package
W
WenmuZhou 已提交
2

W
WenmuZhou 已提交
3 4
## 1 Get started quickly
### 1.1 install package
W
WenmuZhou 已提交
5 6
install by pypi
```bash
W
WenmuZhou 已提交
7
pip install "paddleocr>=2.0.1" # Recommend to use version 2.0.1+
W
WenmuZhou 已提交
8 9 10 11
```

build own whl package and install
```bash
W
WenmuZhou 已提交
12 13
python3 setup.py bdist_wheel
pip3 install dist/paddleocr-x.x.x-py3-none-any.whl # x.x.x is the version of paddleocr
W
WenmuZhou 已提交
14
```
W
WenmuZhou 已提交
15 16 17
## 2 Use
### 2.1 Use by code
The paddleocr whl package will automatically download the ppocr lightweight model as the default model, which can be customized and replaced according to the section 3 **Custom Model**.
W
WenmuZhou 已提交
18

W
WenmuZhou 已提交
19
* detection angle classification and recognition
W
WenmuZhou 已提交
20 21 22 23 24 25 26 27
```python
from paddleocr import PaddleOCR,draw_ocr
# Paddleocr supports Chinese, English, French, German, Korean and Japanese.
# You can set the parameter `lang` as `ch`, `en`, `french`, `german`, `korean`, `japan`
# to switch the language model in order.
ocr = PaddleOCR(use_angle_cls=True, lang='en') # need to run only once to download and load model into memory
img_path = 'PaddleOCR/doc/imgs_en/img_12.jpg'
result = ocr.ocr(img_path, cls=True)
A
andyjpaddle 已提交
28 29 30 31
for idx in range(len(result)):
    res = result[idx]
    for line in res:
        print(line)
W
WenmuZhou 已提交
32 33 34

# draw result
from PIL import Image
A
andyjpaddle 已提交
35
result = result[0]
W
WenmuZhou 已提交
36 37 38 39
image = Image.open(img_path).convert('RGB')
boxes = [line[0] for line in result]
txts = [line[1][0] for line in result]
scores = [line[1][1] for line in result]
W
WenmuZhou 已提交
40
im_show = draw_ocr(image, boxes, txts, scores, font_path='/path/to/PaddleOCR/doc/fonts/simfang.ttf')
W
WenmuZhou 已提交
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
im_show = Image.fromarray(im_show)
im_show.save('result.jpg')
```

Output will be a list, each item contains bounding box, text and recognition confidence
```bash
[[[442.0, 173.0], [1169.0, 173.0], [1169.0, 225.0], [442.0, 225.0]], ['ACKNOWLEDGEMENTS', 0.99283075]]
[[[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]]
[[[399.0, 398.0], [1204.0, 398.0], [1204.0, 433.0], [399.0, 433.0]], ['contributors whohave been involved in the', 0.9592447]]
......
```

Visualization of results

<div align="center">
    <img src="../imgs_results/whl/12_det_rec.jpg" width="800">
</div>

W
WenmuZhou 已提交
59 60 61
* detection and recognition
```python
from paddleocr import PaddleOCR,draw_ocr
W
WenmuZhou 已提交
62
ocr = PaddleOCR(lang='en') # need to run only once to download and load model into memory
W
WenmuZhou 已提交
63
img_path = 'PaddleOCR/doc/imgs_en/img_12.jpg'
64
result = ocr.ocr(img_path, cls=False)
A
andyjpaddle 已提交
65 66 67 68
for idx in range(len(result)):
    res = result[idx]
    for line in res:
        print(line)
W
WenmuZhou 已提交
69 70 71

# draw result
from PIL import Image
A
andyjpaddle 已提交
72
result = result[0]
W
WenmuZhou 已提交
73 74 75 76
image = Image.open(img_path).convert('RGB')
boxes = [line[0] for line in result]
txts = [line[1][0] for line in result]
scores = [line[1][1] for line in result]
W
WenmuZhou 已提交
77
im_show = draw_ocr(image, boxes, txts, scores, font_path='/path/to/PaddleOCR/doc/fonts/simfang.ttf')
W
WenmuZhou 已提交
78 79 80 81 82 83 84 85 86
im_show = Image.fromarray(im_show)
im_show.save('result.jpg')
```

Output will be a list, each item contains bounding box, text and recognition confidence
```bash
[[[442.0, 173.0], [1169.0, 173.0], [1169.0, 225.0], [442.0, 225.0]], ['ACKNOWLEDGEMENTS', 0.99283075]]
[[[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]]
[[[399.0, 398.0], [1204.0, 398.0], [1204.0, 433.0], [399.0, 433.0]], ['contributors whohave been involved in the', 0.9592447]]
W
WenmuZhou 已提交
87
......
W
WenmuZhou 已提交
88 89 90 91 92 93 94 95
```

Visualization of results

<div align="center">
    <img src="../imgs_results/whl/12_det_rec.jpg" width="800">
</div>

W
WenmuZhou 已提交
96 97 98 99 100 101
* classification and recognition
```python
from paddleocr import PaddleOCR
ocr = PaddleOCR(use_angle_cls=True, lang='en') # need to run only once to load model into memory
img_path = 'PaddleOCR/doc/imgs_words_en/word_10.png'
result = ocr.ocr(img_path, det=False, cls=True)
A
andyjpaddle 已提交
102 103 104 105
for idx in range(len(result)):
    res = result[idx]
    for line in res:
        print(line)
W
WenmuZhou 已提交
106 107 108 109 110 111 112
```

Output will be a list, each item contains recognition text and confidence
```bash
['PAIN', 0.990372]
```

W
WenmuZhou 已提交
113 114 115
* only detection
```python
from paddleocr import PaddleOCR,draw_ocr
W
WenmuZhou 已提交
116
ocr = PaddleOCR() # need to run only once to download and load model into memory
W
WenmuZhou 已提交
117 118
img_path = 'PaddleOCR/doc/imgs_en/img_12.jpg'
result = ocr.ocr(img_path,rec=False)
A
andyjpaddle 已提交
119 120 121 122
for idx in range(len(result)):
    res = result[idx]
    for line in res:
        print(line)
W
WenmuZhou 已提交
123 124 125

# draw result
from PIL import Image
A
andyjpaddle 已提交
126
result = result[0]
W
WenmuZhou 已提交
127
image = Image.open(img_path).convert('RGB')
W
WenmuZhou 已提交
128
im_show = draw_ocr(image, result, txts=None, scores=None, font_path='/path/to/PaddleOCR/doc/fonts/simfang.ttf')
W
WenmuZhou 已提交
129 130 131 132 133 134 135 136 137
im_show = Image.fromarray(im_show)
im_show.save('result.jpg')
```

Output will be a list, each item only contains bounding box
```bash
[[756.0, 812.0], [805.0, 812.0], [805.0, 830.0], [756.0, 830.0]]
[[820.0, 803.0], [1085.0, 801.0], [1085.0, 836.0], [820.0, 838.0]]
[[393.0, 801.0], [715.0, 805.0], [715.0, 839.0], [393.0, 836.0]]
W
WenmuZhou 已提交
138
......
W
WenmuZhou 已提交
139 140 141 142 143 144 145 146 147 148 149
```

Visualization of results

<div align="center">
    <img src="../imgs_results/whl/12_det.jpg" width="800">
</div>

* only recognition
```python
from paddleocr import PaddleOCR
W
WenmuZhou 已提交
150
ocr = PaddleOCR(lang='en') # need to run only once to load model into memory
W
WenmuZhou 已提交
151
img_path = 'PaddleOCR/doc/imgs_words_en/word_10.png'
W
WenmuZhou 已提交
152
result = ocr.ocr(img_path, det=False, cls=False)
A
andyjpaddle 已提交
153 154 155 156
for idx in range(len(result)):
    res = result[idx]
    for line in res:
        print(line)
W
WenmuZhou 已提交
157 158
```

W
WenmuZhou 已提交
159
Output will be a list, each item contains recognition text and confidence
W
WenmuZhou 已提交
160 161 162 163
```bash
['PAIN', 0.990372]
```

W
WenmuZhou 已提交
164 165 166 167 168 169
* only classification
```python
from paddleocr import PaddleOCR
ocr = PaddleOCR(use_angle_cls=True) # need to run only once to load model into memory
img_path = 'PaddleOCR/doc/imgs_words_en/word_10.png'
result = ocr.ocr(img_path, det=False, rec=False, cls=True)
A
andyjpaddle 已提交
170 171 172 173
for idx in range(len(result)):
    res = result[idx]
    for line in res:
        print(line)
W
WenmuZhou 已提交
174 175 176 177 178 179 180
```

Output will be a list, each item contains classification result and confidence
```bash
['0', 0.99999964]
```

W
WenmuZhou 已提交
181
### 2.2 Use by command line
W
WenmuZhou 已提交
182 183 184 185 186 187

show help information
```bash
paddleocr -h
```

W
WenmuZhou 已提交
188 189
* detection classification and recognition
```bash
A
andyjpaddle 已提交
190
paddleocr --image_dir PaddleOCR/doc/imgs_en/img_12.jpg --use_angle_cls true --lang en
W
WenmuZhou 已提交
191 192 193 194
```

Output will be a list, each item contains bounding box, text and recognition confidence
```bash
195 196 197
[[[441.0, 174.0], [1166.0, 176.0], [1165.0, 222.0], [441.0, 221.0]], ('ACKNOWLEDGEMENTS', 0.9971134662628174)]
[[[403.0, 346.0], [1204.0, 348.0], [1204.0, 384.0], [402.0, 383.0]], ('We would like to thank all the designers and', 0.9761400818824768)]
[[[403.0, 396.0], [1204.0, 398.0], [1204.0, 434.0], [402.0, 433.0]], ('contributors who have been involved in the', 0.9791957139968872)]
W
WenmuZhou 已提交
198 199 200
......
```

A
andyjpaddle 已提交
201 202 203 204 205
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
```bash
paddleocr --image_dir ./xxx.pdf --use_angle_cls true --use_gpu false --page_num 2
```

W
WenmuZhou 已提交
206 207
* detection and recognition
```bash
A
andyjpaddle 已提交
208
paddleocr --image_dir PaddleOCR/doc/imgs_en/img_12.jpg --lang en
W
WenmuZhou 已提交
209 210 211 212
```

Output will be a list, each item contains bounding box, text and recognition confidence
```bash
213 214 215
[[[441.0, 174.0], [1166.0, 176.0], [1165.0, 222.0], [441.0, 221.0]], ('ACKNOWLEDGEMENTS', 0.9971134662628174)]
[[[403.0, 346.0], [1204.0, 348.0], [1204.0, 384.0], [402.0, 383.0]], ('We would like to thank all the designers and', 0.9761400818824768)]
[[[403.0, 396.0], [1204.0, 398.0], [1204.0, 434.0], [402.0, 433.0]], ('contributors who have been involved in the', 0.9791957139968872)]
W
WenmuZhou 已提交
216
......
W
WenmuZhou 已提交
217 218
```

W
WenmuZhou 已提交
219 220
* classification and recognition
```bash
A
andyjpaddle 已提交
221
paddleocr --image_dir PaddleOCR/doc/imgs_words_en/word_10.png --use_angle_cls true --det false --lang en
W
WenmuZhou 已提交
222 223 224 225
```

Output will be a list, each item contains text and recognition confidence
```bash
226
['PAIN', 0.9934559464454651]
W
WenmuZhou 已提交
227 228
```

W
WenmuZhou 已提交
229 230 231 232 233 234 235
* only detection
```bash
paddleocr --image_dir PaddleOCR/doc/imgs_en/img_12.jpg --rec false
```

Output will be a list, each item only contains bounding box
```bash
236 237 238
[[397.0, 802.0], [1092.0, 802.0], [1092.0, 841.0], [397.0, 841.0]]
[[397.0, 750.0], [1211.0, 750.0], [1211.0, 789.0], [397.0, 789.0]]
[[397.0, 702.0], [1209.0, 698.0], [1209.0, 734.0], [397.0, 738.0]]
W
WenmuZhou 已提交
239
......
W
WenmuZhou 已提交
240 241 242 243
```

* only recognition
```bash
A
andyjpaddle 已提交
244
paddleocr --image_dir PaddleOCR/doc/imgs_words_en/word_10.png --det false --lang en
W
WenmuZhou 已提交
245 246 247 248
```

Output will be a list, each item contains text and recognition confidence
```bash
249
['PAIN', 0.9934559464454651]
W
WenmuZhou 已提交
250 251
```

W
WenmuZhou 已提交
252 253
* only classification
```bash
W
WenmuZhou 已提交
254
paddleocr --image_dir PaddleOCR/doc/imgs_words_en/word_10.png --use_angle_cls true --det false --rec false
W
WenmuZhou 已提交
255 256 257 258 259 260 261
```

Output will be a list, each item contains classification result and confidence
```bash
['0', 0.99999964]
```

W
WenmuZhou 已提交
262
## 3 Use custom model
W
WenmuZhou 已提交
263
When the built-in model cannot meet the needs, you need to use your own trained model.
A
andyj 已提交
264
First, refer to [export](./detection_en.md#4-inference) doc to convert your det and rec model to inference model, and then use it as follows
W
WenmuZhou 已提交
265

W
WenmuZhou 已提交
266
### 3.1 Use by code
W
WenmuZhou 已提交
267 268 269 270

```python
from paddleocr import PaddleOCR,draw_ocr
# The path of detection and recognition model must contain model and params files
W
WenmuZhou 已提交
271
ocr = PaddleOCR(det_model_dir='{your_det_model_dir}', rec_model_dir='{your_rec_model_dir}', rec_char_dict_path='{your_rec_char_dict_path}', cls_model_dir='{your_cls_model_dir}', use_angle_cls=True)
W
WenmuZhou 已提交
272
img_path = 'PaddleOCR/doc/imgs_en/img_12.jpg'
W
WenmuZhou 已提交
273
result = ocr.ocr(img_path, cls=True)
A
andyjpaddle 已提交
274 275 276 277
for idx in range(len(result)):
    res = result[idx]
    for line in res:
        print(line)
W
WenmuZhou 已提交
278 279 280

# draw result
from PIL import Image
A
andyjpaddle 已提交
281
result = result[0]
W
WenmuZhou 已提交
282 283 284 285
image = Image.open(img_path).convert('RGB')
boxes = [line[0] for line in result]
txts = [line[1][0] for line in result]
scores = [line[1][1] for line in result]
W
WenmuZhou 已提交
286
im_show = draw_ocr(image, boxes, txts, scores, font_path='/path/to/PaddleOCR/doc/fonts/simfang.ttf')
W
WenmuZhou 已提交
287 288 289 290
im_show = Image.fromarray(im_show)
im_show.save('result.jpg')
```

W
WenmuZhou 已提交
291
### 3.2 Use by command line
W
WenmuZhou 已提交
292 293

```bash
W
WenmuZhou 已提交
294
paddleocr --image_dir PaddleOCR/doc/imgs/11.jpg --det_model_dir {your_det_model_dir} --rec_model_dir {your_rec_model_dir} --rec_char_dict_path {your_rec_char_dict_path} --cls_model_dir {your_cls_model_dir} --use_angle_cls true
W
WenmuZhou 已提交
295 296
```

W
WenmuZhou 已提交
297
## 4 Use web images or numpy array as input
W
WenmuZhou 已提交
298

W
WenmuZhou 已提交
299
### 4.1 Web image
W
WenmuZhou 已提交
300

W
WenmuZhou 已提交
301
- Use by code
W
WenmuZhou 已提交
302 303 304 305 306
```python
from paddleocr import PaddleOCR, draw_ocr
ocr = PaddleOCR(use_angle_cls=True, lang="ch") # need to run only once to download and load model into memory
img_path = 'http://n.sinaimg.cn/ent/transform/w630h933/20171222/o111-fypvuqf1838418.jpg'
result = ocr.ocr(img_path, cls=True)
A
andyjpaddle 已提交
307 308 309 310
for idx in range(len(result)):
    res = result[idx]
    for line in res:
        print(line)
W
WenmuZhou 已提交
311 312 313

# show result
from PIL import Image
A
andyjpaddle 已提交
314
result = result[0]
W
WenmuZhou 已提交
315 316 317 318
image = Image.open(img_path).convert('RGB')
boxes = [line[0] for line in result]
txts = [line[1][0] for line in result]
scores = [line[1][1] for line in result]
W
WenmuZhou 已提交
319
im_show = draw_ocr(image, boxes, txts, scores, font_path='/path/to/PaddleOCR/doc/fonts/simfang.ttf')
W
WenmuZhou 已提交
320 321 322
im_show = Image.fromarray(im_show)
im_show.save('result.jpg')
```
W
WenmuZhou 已提交
323
- Use by command line
W
WenmuZhou 已提交
324 325 326 327
```bash
paddleocr --image_dir http://n.sinaimg.cn/ent/transform/w630h933/20171222/o111-fypvuqf1838418.jpg --use_angle_cls=true
```

W
WenmuZhou 已提交
328
### 4.2 Numpy array
W
WenmuZhou 已提交
329 330 331
Support numpy array as input only when used by code

```python
W
WenmuZhou 已提交
332
import cv2
333
from paddleocr import PaddleOCR, draw_ocr, download_with_progressbar
W
WenmuZhou 已提交
334 335 336 337 338
ocr = PaddleOCR(use_angle_cls=True, lang="ch") # need to run only once to download and load model into memory
img_path = 'PaddleOCR/doc/imgs/11.jpg'
img = cv2.imread(img_path)
# img = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY), If your own training model supports grayscale images, you can uncomment this line
result = ocr.ocr(img_path, cls=True)
A
andyjpaddle 已提交
339 340 341 342
for idx in range(len(result)):
    res = result[idx]
    for line in res:
        print(line)
W
WenmuZhou 已提交
343 344 345

# show result
from PIL import Image
A
andyjpaddle 已提交
346
result = result[0]
347 348
download_with_progressbar(img_path, 'tmp.jpg')
image = Image.open('tmp.jpg').convert('RGB')
W
WenmuZhou 已提交
349 350 351
boxes = [line[0] for line in result]
txts = [line[1][0] for line in result]
scores = [line[1][1] for line in result]
W
WenmuZhou 已提交
352
im_show = draw_ocr(image, boxes, txts, scores, font_path='/path/to/PaddleOCR/doc/fonts/simfang.ttf')
W
WenmuZhou 已提交
353 354 355
im_show = Image.fromarray(im_show)
im_show.save('result.jpg')
```
A
andyjpaddle 已提交
356 357 358 359 360 361 362 363
## 5 PDF file
- Use by command line

you can infer the first few pages by using the `page_num` parameter, the default is 0, which means infer all pages
```bash
paddleocr --image_dir ./xxx.pdf --use_angle_cls true --use_gpu false --page_num 2
```
- Use by code
W
WenmuZhou 已提交
364

A
andyjpaddle 已提交
365 366 367 368 369 370 371 372 373 374 375 376 377
```python
from paddleocr import PaddleOCR, draw_ocr

# Paddleocr supports Chinese, English, French, German, Korean and Japanese.
# You can set the parameter `lang` as `ch`, `en`, `fr`, `german`, `korean`, `japan`
# to switch the language model in order.
ocr = PaddleOCR(use_angle_cls=True, lang="ch" page_num=2)  # need to run only once to download and load model into memory
img_path = './xxx.pdf'
result = ocr.ocr(img_path, cls=True)
for idx in range(len(result)):
    res = result[idx]
    for line in res:
        print(line)
W
WenmuZhou 已提交
378

A
andyjpaddle 已提交
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408
# draw result
import fitz
from PIL import Image
import cv2
import numpy as np
imgs = []
with fitz.open(img_path) as pdf:
    for pg in range(0, pdf.pageCount):
        page = pdf[pg]
        mat = fitz.Matrix(2, 2)
        pm = page.getPixmap(matrix=mat, alpha=False)
        # if width or height > 2000 pixels, don't enlarge the image
        if pm.width > 2000 or pm.height > 2000:
            pm = page.getPixmap(matrix=fitz.Matrix(1, 1), alpha=False)

        img = Image.frombytes("RGB", [pm.width, pm.height], pm.samples)
        img = cv2.cvtColor(np.array(img), cv2.COLOR_RGB2BGR)
        imgs.append(img)
for idx in range(len(result)):
    res = result[idx]
    image = imgs[idx]
    boxes = [line[0] for line in res]
    txts = [line[1][0] for line in res]
    scores = [line[1][1] for line in res]
    im_show = draw_ocr(image, boxes, txts, scores, font_path='doc/fonts/simfang.ttf')
    im_show = Image.fromarray(im_show)
    im_show.save('result_page_{}.jpg'.format(idx))
```

## 6 Parameter Description
W
WenmuZhou 已提交
409 410 411 412 413 414

| Parameter                    | Description                                                                                                                                                                                                                 | Default value                  |
|-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------|
| use_gpu                 | use GPU or not                                                                                                                                                                                                          | TRUE                    |
| gpu_mem                 | GPU memory size used for initialization                                                                                                                                                                                              | 8000M                   |
| image_dir               | The images path or folder path for predicting when used by the command line                                                                                                                                                                           |                         |
A
andyjpaddle 已提交
415
| page_num               | Valid when the input type is pdf file, specify to predict the previous page_num pages, all pages are predicted by default                                                                                                                                                                           |          0               |
W
WenmuZhou 已提交
416
| det_algorithm           | Type of detection algorithm selected                                                                                                                                                                                                   | DB                      |
W
WenmuZhou 已提交
417
| det_model_dir           | the text detection inference model folder. There are two ways to transfer parameters, 1. None: Automatically download the built-in model to `~/.paddleocr/det`; 2. The path of the inference model converted by yourself, the model and params files must be included in the model path | None           |
W
WenmuZhou 已提交
418 419 420 421
| det_max_side_len        | The maximum size of the long side of the image. When the long side exceeds this value, the long side will be resized to this size, and the short side will be scaled proportionally                                                                                                                         | 960                     |
| det_db_thresh           | Binarization threshold value of DB output map                                                                                                                                                                                        | 0.3                     |
| det_db_box_thresh       | The threshold value of the DB output box. Boxes score lower than this value will be discarded                                                                                                                                                                         | 0.5                     |
| det_db_unclip_ratio     | The expanded ratio of DB output box                                                                                                                                                                                             | 2                       |
L
LDOUBLEV 已提交
422
| det_db_score_mode |  The parameter that control how the score of the detection frame is calculated. There are 'fast' and 'slow' options. If the text to be detected is curved, it is recommended to use 'slow'  | 'fast' |
W
WenmuZhou 已提交
423 424 425 426
| det_east_score_thresh   | Binarization threshold value of EAST output map                                                                                                                                                                                       | 0.8                     |
| det_east_cover_thresh   | The threshold value of the EAST output box. Boxes score lower than this value will be discarded                                                                                                                                                                         | 0.1                     |
| det_east_nms_thresh     | The NMS threshold value of EAST model output box                                                                                                                                                                                              | 0.2                     |
| rec_algorithm           | Type of recognition algorithm selected                                                                                                                                                                                                | CRNN                    |
W
WenmuZhou 已提交
427
| rec_model_dir           | the text recognition inference model folder. There are two ways to transfer parameters, 1. None: Automatically download the built-in model to `~/.paddleocr/rec`; 2. The path of the inference model converted by yourself, the model and params files must be included in the model path | None |
W
WenmuZhou 已提交
428 429
| rec_image_shape         | image shape of recognition algorithm                                                                                                                                                                                            | "3,32,320"              |
| rec_batch_num           | When performing recognition, the batchsize of forward images                                                                                                                                                                                         | 30                      |
W
WenmuZhou 已提交
430 431
| max_text_length         | The maximum text length that the recognition algorithm can recognize                                                                                                                                                                                         | 25                      |
| rec_char_dict_path      | the alphabet path which needs to be modified to your own path when `rec_model_Name` use mode 2                                                                                                                                              | ./ppocr/utils/ppocr_keys_v1.txt                        |
W
WenmuZhou 已提交
432
| use_space_char          | Whether to recognize spaces                                                                                                                                                                                                         | TRUE                    |
W
WenmuZhou 已提交
433
| drop_score          | Filter the output by score (from the recognition model), and those below this score will not be returned                                                                                                                                                                                                        | 0.5                    |
W
WenmuZhou 已提交
434 435 436 437 438
| use_angle_cls          | Whether to load classification model                                                                                                                                                                                                       | FALSE                    |
| cls_model_dir           | the classification inference model folder. There are two ways to transfer parameters, 1. None: Automatically download the built-in model to `~/.paddleocr/cls`; 2. The path of the inference model converted by yourself, the model and params files must be included in the model path | None |
| cls_image_shape         | image shape of classification algorithm                                                                                                                                                                                            | "3,48,192"              |
| label_list         | label list of classification algorithm                                                                                                                                                                                            | ['0','180']           |
| cls_batch_num           | When performing classification, the batchsize of forward images                                                                                                                                                                                         | 30                      |
W
WenmuZhou 已提交
439
| enable_mkldnn           | Whether to enable mkldnn                                                                                                                                                                                                       | FALSE                   |
W
WenmuZhou 已提交
440 441
| use_zero_copy_run           | Whether to forward by zero_copy_run                                                                                                                                                                               | FALSE                   |
| lang                     | The support language, now only Chinese(ch)、English(en)、French(french)、German(german)、Korean(korean)、Japanese(japan) are supported                                                                                                                                                                                                  | ch                    |
W
WenmuZhou 已提交
442
| det                     | Enable detction when `ppocr.ocr` func exec                                                                                                                                                                                                   | TRUE                    |
W
WenmuZhou 已提交
443
| rec                     | Enable recognition when `ppocr.ocr` func exec                                                                                                                                                                                                   | TRUE                    |
W
WenmuZhou 已提交
444
| cls                     | Enable classification when `ppocr.ocr` func exec((Use use_angle_cls in command line mode to control whether to start classification in the forward direction)                                                                                                                                                                                                   | FALSE                    |
文幕地方's avatar
文幕地方 已提交
445
| show_log                     | Whether to print log| FALSE                    |
Z
zhoujun 已提交
446
| type                     | Perform ocr or table structuring, the value is selected in ['ocr','structure']                                                                                                                                                                                             | ocr                    |
A
andyjpaddle 已提交
447
| ocr_version                     | OCR Model version number, the current model support list is as follows: PP-OCRv3 supports Chinese and English detection, recognition, multilingual recognition, direction classifier models, PP-OCRv2 support Chinese detection and recognition model, PP-OCR support Chinese detection, recognition and direction classifier, multilingual recognition model | PP-OCRv3                 |