whl.md 20.7 KB
Newer Older
WenmuZhou's avatar
WenmuZhou committed
1
2
# paddleocr package使用说明

WenmuZhou's avatar
WenmuZhou committed
3
## 1 快速上手
WenmuZhou's avatar
WenmuZhou committed
4

WenmuZhou's avatar
WenmuZhou committed
5
### 1.1 安装whl包
WenmuZhou's avatar
WenmuZhou committed
6
7

pip安装
8

WenmuZhou's avatar
WenmuZhou committed
9
```bash
WenmuZhou's avatar
WenmuZhou committed
10
pip install "paddleocr>=2.0.1" # 推荐使用2.0.1+版本
WenmuZhou's avatar
WenmuZhou committed
11
12
13
```

本地构建并安装
14

WenmuZhou's avatar
WenmuZhou committed
15
```bash
WenmuZhou's avatar
WenmuZhou committed
16
17
python3 setup.py bdist_wheel
pip3 install dist/paddleocr-x.x.x-py3-none-any.whl # x.x.x是paddleocr的版本号
WenmuZhou's avatar
WenmuZhou committed
18
19
```

WenmuZhou's avatar
WenmuZhou committed
20
## 2 使用
21

WenmuZhou's avatar
WenmuZhou committed
22
### 2.1 代码使用
23

WenmuZhou's avatar
WenmuZhou committed
24
25
26
paddleocr whl包会自动下载ppocr轻量级模型作为默认模型,可以根据第3节**自定义模型**进行自定义更换。

* 检测+方向分类器+识别全流程
27

WenmuZhou's avatar
WenmuZhou committed
28
29
```python
from paddleocr import PaddleOCR, draw_ocr
30

WenmuZhou's avatar
WenmuZhou committed
31
32
# Paddleocr目前支持中英文、英文、法语、德语、韩语、日语,可以通过修改lang参数进行切换
# 参数依次为`ch`, `en`, `french`, `german`, `korean`, `japan`。
33
ocr = PaddleOCR(use_angle_cls=True, lang="ch")  # need to run only once to download and load model into memory
WenmuZhou's avatar
WenmuZhou committed
34
35
36
37
38
39
40
img_path = 'PaddleOCR/doc/imgs/11.jpg'
result = ocr.ocr(img_path, cls=True)
for line in result:
    print(line)

# 显示结果
from PIL import Image
41

WenmuZhou's avatar
WenmuZhou committed
42
43
44
45
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]
WenmuZhou's avatar
WenmuZhou committed
46
im_show = draw_ocr(image, boxes, txts, scores, font_path='/path/to/PaddleOCR/doc/fonts/simfang.ttf')
WenmuZhou's avatar
WenmuZhou committed
47
48
49
im_show = Image.fromarray(im_show)
im_show.save('result.jpg')
```
50

WenmuZhou's avatar
WenmuZhou committed
51
结果是一个list,每个item包含了文本框,文字和识别置信度
52

WenmuZhou's avatar
WenmuZhou committed
53
54
55
56
57
58
```bash
[[[24.0, 36.0], [304.0, 34.0], [304.0, 72.0], [24.0, 74.0]], ['纯臻营养护发素', 0.964739]]
[[[24.0, 80.0], [172.0, 80.0], [172.0, 104.0], [24.0, 104.0]], ['产品信息/参数', 0.98069626]]
[[[24.0, 109.0], [333.0, 109.0], [333.0, 136.0], [24.0, 136.0]], ['(45元/每公斤,100公斤起订)', 0.9676722]]
......
```
59

WenmuZhou's avatar
WenmuZhou committed
60
61
62
63
64
65
66
结果可视化

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

* 检测+识别
67

WenmuZhou's avatar
WenmuZhou committed
68
69
```python
from paddleocr import PaddleOCR, draw_ocr
70
71

ocr = PaddleOCR()  # need to run only once to download and load model into memory
WenmuZhou's avatar
WenmuZhou committed
72
img_path = 'PaddleOCR/doc/imgs/11.jpg'
73
result = ocr.ocr(img_path, cls=False)
WenmuZhou's avatar
WenmuZhou committed
74
75
76
77
78
for line in result:
    print(line)

# 显示结果
from PIL import Image
79

WenmuZhou's avatar
WenmuZhou committed
80
81
82
83
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]
WenmuZhou's avatar
WenmuZhou committed
84
im_show = draw_ocr(image, boxes, txts, scores, font_path='/path/to/PaddleOCR/doc/fonts/simfang.ttf')
WenmuZhou's avatar
WenmuZhou committed
85
86
87
im_show = Image.fromarray(im_show)
im_show.save('result.jpg')
```
88

WenmuZhou's avatar
WenmuZhou committed
89
结果是一个list,每个item包含了文本框,文字和识别置信度
90

WenmuZhou's avatar
WenmuZhou committed
91
92
93
94
```bash
[[[24.0, 36.0], [304.0, 34.0], [304.0, 72.0], [24.0, 74.0]], ['纯臻营养护发素', 0.964739]]
[[[24.0, 80.0], [172.0, 80.0], [172.0, 104.0], [24.0, 104.0]], ['产品信息/参数', 0.98069626]]
[[[24.0, 109.0], [333.0, 109.0], [333.0, 136.0], [24.0, 136.0]], ['(45元/每公斤,100公斤起订)', 0.9676722]]
WenmuZhou's avatar
WenmuZhou committed
95
......
WenmuZhou's avatar
WenmuZhou committed
96
```
97

WenmuZhou's avatar
WenmuZhou committed
98
99
100
101
102
103
结果可视化

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

WenmuZhou's avatar
WenmuZhou committed
104
* 方向分类器+识别
105

WenmuZhou's avatar
WenmuZhou committed
106
107
```python
from paddleocr import PaddleOCR
108
109

ocr = PaddleOCR(use_angle_cls=True)  # need to run only once to download and load model into memory
WenmuZhou's avatar
WenmuZhou committed
110
111
112
113
114
img_path = 'PaddleOCR/doc/imgs_words/ch/word_1.jpg'
result = ocr.ocr(img_path, det=False, cls=True)
for line in result:
    print(line)
```
115

WenmuZhou's avatar
WenmuZhou committed
116
结果是一个list,每个item只包含识别结果和识别置信度
117

WenmuZhou's avatar
WenmuZhou committed
118
119
120
121
```bash
['韩国小馆', 0.9907421]
```

WenmuZhou's avatar
WenmuZhou committed
122
* 单独执行检测
123

WenmuZhou's avatar
WenmuZhou committed
124
125
```python
from paddleocr import PaddleOCR, draw_ocr
126
127

ocr = PaddleOCR()  # need to run only once to download and load model into memory
WenmuZhou's avatar
WenmuZhou committed
128
img_path = 'PaddleOCR/doc/imgs/11.jpg'
WenmuZhou's avatar
WenmuZhou committed
129
result = ocr.ocr(img_path, rec=False)
WenmuZhou's avatar
WenmuZhou committed
130
131
132
133
134
135
136
for line in result:
    print(line)

# 显示结果
from PIL import Image

image = Image.open(img_path).convert('RGB')
WenmuZhou's avatar
WenmuZhou committed
137
im_show = draw_ocr(image, result, txts=None, scores=None, font_path='/path/to/PaddleOCR/doc/fonts/simfang.ttf')
WenmuZhou's avatar
WenmuZhou committed
138
139
140
im_show = Image.fromarray(im_show)
im_show.save('result.jpg')
```
141

WenmuZhou's avatar
WenmuZhou committed
142
结果是一个list,每个item只包含文本框
143

WenmuZhou's avatar
WenmuZhou committed
144
145
146
147
```bash
[[26.0, 457.0], [137.0, 457.0], [137.0, 477.0], [26.0, 477.0]]
[[25.0, 425.0], [372.0, 425.0], [372.0, 448.0], [25.0, 448.0]]
[[128.0, 397.0], [273.0, 397.0], [273.0, 414.0], [128.0, 414.0]]
WenmuZhou's avatar
WenmuZhou committed
148
......
WenmuZhou's avatar
WenmuZhou committed
149
```
150

WenmuZhou's avatar
WenmuZhou committed
151
152
153
154
155
156
157
158
结果可视化


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

* 单独执行识别
159

WenmuZhou's avatar
WenmuZhou committed
160
161
```python
from paddleocr import PaddleOCR
162
163

ocr = PaddleOCR()  # need to run only once to download and load model into memory
WenmuZhou's avatar
WenmuZhou committed
164
img_path = 'PaddleOCR/doc/imgs_words/ch/word_1.jpg'
WenmuZhou's avatar
WenmuZhou committed
165
result = ocr.ocr(img_path, det=False)
WenmuZhou's avatar
WenmuZhou committed
166
167
168
for line in result:
    print(line)
```
169

WenmuZhou's avatar
WenmuZhou committed
170
结果是一个list,每个item只包含识别结果和识别置信度
171

WenmuZhou's avatar
WenmuZhou committed
172
173
174
175
```bash
['韩国小馆', 0.9907421]
```

WenmuZhou's avatar
WenmuZhou committed
176
* 单独执行方向分类器
177

WenmuZhou's avatar
WenmuZhou committed
178
179
```python
from paddleocr import PaddleOCR
180
181

ocr = PaddleOCR(use_angle_cls=True)  # need to run only once to download and load model into memory
WenmuZhou's avatar
WenmuZhou committed
182
183
184
185
186
img_path = 'PaddleOCR/doc/imgs_words/ch/word_1.jpg'
result = ocr.ocr(img_path, det=False, rec=False, cls=True)
for line in result:
    print(line)
```
187

WenmuZhou's avatar
WenmuZhou committed
188
结果是一个list,每个item只包含分类结果和分类置信度
189

WenmuZhou's avatar
WenmuZhou committed
190
191
192
193
```bash
['0', 0.9999924]
```

WenmuZhou's avatar
WenmuZhou committed
194
### 2.2 通过命令行使用
WenmuZhou's avatar
WenmuZhou committed
195
196

查看帮助信息
197

WenmuZhou's avatar
WenmuZhou committed
198
199
200
201
```bash
paddleocr -h
```

WenmuZhou's avatar
WenmuZhou committed
202
* 检测+方向分类器+识别全流程
203

WenmuZhou's avatar
WenmuZhou committed
204
```bash
WenmuZhou's avatar
WenmuZhou committed
205
paddleocr --image_dir PaddleOCR/doc/imgs/11.jpg --use_angle_cls true
WenmuZhou's avatar
WenmuZhou committed
206
```
207

WenmuZhou's avatar
WenmuZhou committed
208
结果是一个list,每个item包含了文本框,文字和识别置信度
209

WenmuZhou's avatar
WenmuZhou committed
210
211
212
```bash
[[[24.0, 36.0], [304.0, 34.0], [304.0, 72.0], [24.0, 74.0]], ['纯臻营养护发素', 0.964739]]
[[[24.0, 80.0], [172.0, 80.0], [172.0, 104.0], [24.0, 104.0]], ['产品信息/参数', 0.98069626]]
Leif's avatar
Leif committed
213
[[[24.0, 109.0], [333.0, 109.0], [333.0, 136.0], [24.0, 136.0]], ['(45元/每公斤,100公斤起订)', 0.9676722]]µ
WenmuZhou's avatar
WenmuZhou committed
214
215
216
217
......
```

* 检测+识别
218

WenmuZhou's avatar
WenmuZhou committed
219
220
221
```bash
paddleocr --image_dir PaddleOCR/doc/imgs/11.jpg
```
222

WenmuZhou's avatar
WenmuZhou committed
223
结果是一个list,每个item包含了文本框,文字和识别置信度
224

WenmuZhou's avatar
WenmuZhou committed
225
226
227
228
```bash
[[[24.0, 36.0], [304.0, 34.0], [304.0, 72.0], [24.0, 74.0]], ['纯臻营养护发素', 0.964739]]
[[[24.0, 80.0], [172.0, 80.0], [172.0, 104.0], [24.0, 104.0]], ['产品信息/参数', 0.98069626]]
[[[24.0, 109.0], [333.0, 109.0], [333.0, 136.0], [24.0, 136.0]], ['(45元/每公斤,100公斤起订)', 0.9676722]]
WenmuZhou's avatar
WenmuZhou committed
229
......
WenmuZhou's avatar
WenmuZhou committed
230
231
```

WenmuZhou's avatar
WenmuZhou committed
232
* 方向分类器+识别
233

WenmuZhou's avatar
WenmuZhou committed
234
```bash
WenmuZhou's avatar
WenmuZhou committed
235
paddleocr --image_dir PaddleOCR/doc/imgs_words/ch/word_1.jpg --use_angle_cls true --det false
WenmuZhou's avatar
WenmuZhou committed
236
237
238
```

结果是一个list,每个item只包含识别结果和识别置信度
239

WenmuZhou's avatar
WenmuZhou committed
240
241
242
243
```bash
['韩国小馆', 0.9907421]
```

WenmuZhou's avatar
WenmuZhou committed
244
* 单独执行检测
245

WenmuZhou's avatar
WenmuZhou committed
246
247
248
```bash
paddleocr --image_dir PaddleOCR/doc/imgs/11.jpg --rec false
```
249

WenmuZhou's avatar
WenmuZhou committed
250
结果是一个list,每个item只包含文本框
251

WenmuZhou's avatar
WenmuZhou committed
252
253
254
255
```bash
[[26.0, 457.0], [137.0, 457.0], [137.0, 477.0], [26.0, 477.0]]
[[25.0, 425.0], [372.0, 425.0], [372.0, 448.0], [25.0, 448.0]]
[[128.0, 397.0], [273.0, 397.0], [273.0, 414.0], [128.0, 414.0]]
WenmuZhou's avatar
WenmuZhou committed
256
......
WenmuZhou's avatar
WenmuZhou committed
257
258
259
```

* 单独执行识别
260

WenmuZhou's avatar
WenmuZhou committed
261
262
263
264
265
```bash
paddleocr --image_dir PaddleOCR/doc/imgs_words/ch/word_1.jpg --det false
```

结果是一个list,每个item只包含识别结果和识别置信度
266

WenmuZhou's avatar
WenmuZhou committed
267
268
269
270
```bash
['韩国小馆', 0.9907421]
```

WenmuZhou's avatar
WenmuZhou committed
271
* 单独执行方向分类器
272

WenmuZhou's avatar
WenmuZhou committed
273
```bash
WenmuZhou's avatar
WenmuZhou committed
274
paddleocr --image_dir PaddleOCR/doc/imgs_words/ch/word_1.jpg --use_angle_cls true --det false --rec false
WenmuZhou's avatar
WenmuZhou committed
275
276
277
```

结果是一个list,每个item只包含分类结果和分类置信度
278

WenmuZhou's avatar
WenmuZhou committed
279
280
281
282
```bash
['0', 0.9999924]
```

WenmuZhou's avatar
WenmuZhou committed
283
## 3 自定义模型
284
285

当内置模型无法满足需求时,需要使用到自己训练的模型。 首先,参照[inference.md](./inference.md) 第一节转换将检测、分类和识别模型转换为inference模型,然后按照如下方式使用
WenmuZhou's avatar
WenmuZhou committed
286

WenmuZhou's avatar
WenmuZhou committed
287
### 3.1 代码使用
288

WenmuZhou's avatar
WenmuZhou committed
289
290
```python
from paddleocr import PaddleOCR, draw_ocr
291

WenmuZhou's avatar
WenmuZhou committed
292
# 模型路径下必须含有model和params文件
293
294
295
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)
WenmuZhou's avatar
WenmuZhou committed
296
img_path = 'PaddleOCR/doc/imgs/11.jpg'
WenmuZhou's avatar
WenmuZhou committed
297
result = ocr.ocr(img_path, cls=True)
WenmuZhou's avatar
WenmuZhou committed
298
299
300
301
302
for line in result:
    print(line)

# 显示结果
from PIL import Image
303

WenmuZhou's avatar
WenmuZhou committed
304
305
306
307
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]
WenmuZhou's avatar
WenmuZhou committed
308
im_show = draw_ocr(image, boxes, txts, scores, font_path='/path/to/PaddleOCR/doc/fonts/simfang.ttf')
WenmuZhou's avatar
WenmuZhou committed
309
310
311
312
im_show = Image.fromarray(im_show)
im_show.save('result.jpg')
```

WenmuZhou's avatar
WenmuZhou committed
313
### 3.2 通过命令行使用
WenmuZhou's avatar
WenmuZhou committed
314
315

```bash
WenmuZhou's avatar
WenmuZhou committed
316
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
WenmuZhou's avatar
WenmuZhou committed
317
318
```

WenmuZhou's avatar
WenmuZhou committed
319
## 4 使用网络图片或者numpy数组作为输入
WenmuZhou's avatar
WenmuZhou committed
320

WenmuZhou's avatar
WenmuZhou committed
321
### 4.1 网络图片
WenmuZhou's avatar
WenmuZhou committed
322

WenmuZhou's avatar
WenmuZhou committed
323
- 代码使用
324

WenmuZhou's avatar
WenmuZhou committed
325
```python
326
327
from paddleocr import PaddleOCR, draw_ocr, download_with_progressbar

WenmuZhou's avatar
WenmuZhou committed
328
329
# Paddleocr目前支持中英文、英文、法语、德语、韩语、日语,可以通过修改lang参数进行切换
# 参数依次为`ch`, `en`, `french`, `german`, `korean`, `japan`。
330
ocr = PaddleOCR(use_angle_cls=True, lang="ch")  # need to run only once to download and load model into memory
WenmuZhou's avatar
WenmuZhou committed
331
332
333
334
335
336
337
img_path = 'http://n.sinaimg.cn/ent/transform/w630h933/20171222/o111-fypvuqf1838418.jpg'
result = ocr.ocr(img_path, cls=True)
for line in result:
    print(line)

# 显示结果
from PIL import Image
338
339
340

download_with_progressbar(img_path, 'tmp.jpg')
image = Image.open('tmp.jpg').convert('RGB')
WenmuZhou's avatar
WenmuZhou committed
341
342
343
boxes = [line[0] for line in result]
txts = [line[1][0] for line in result]
scores = [line[1][1] for line in result]
WenmuZhou's avatar
WenmuZhou committed
344
im_show = draw_ocr(image, boxes, txts, scores, font_path='/path/to/PaddleOCR/doc/fonts/simfang.ttf')
WenmuZhou's avatar
WenmuZhou committed
345
346
347
im_show = Image.fromarray(im_show)
im_show.save('result.jpg')
```
348

WenmuZhou's avatar
WenmuZhou committed
349
- 命令行模式
350

WenmuZhou's avatar
WenmuZhou committed
351
352
353
354
```bash
paddleocr --image_dir http://n.sinaimg.cn/ent/transform/w630h933/20171222/o111-fypvuqf1838418.jpg --use_angle_cls=true
```

WenmuZhou's avatar
WenmuZhou committed
355
### 4.2 numpy数组
356

WenmuZhou's avatar
WenmuZhou committed
357
仅通过代码使用时支持numpy数组作为输入
358

WenmuZhou's avatar
WenmuZhou committed
359
```python
WenmuZhou's avatar
WenmuZhou committed
360
import cv2
WenmuZhou's avatar
WenmuZhou committed
361
from paddleocr import PaddleOCR, draw_ocr
362

WenmuZhou's avatar
WenmuZhou committed
363
364
# Paddleocr目前支持中英文、英文、法语、德语、韩语、日语,可以通过修改lang参数进行切换
# 参数依次为`ch`, `en`, `french`, `german`, `korean`, `japan`。
365
ocr = PaddleOCR(use_angle_cls=True, lang="ch")  # need to run only once to download and load model into memory
WenmuZhou's avatar
WenmuZhou committed
366
367
368
img_path = 'PaddleOCR/doc/imgs/11.jpg'
img = cv2.imread(img_path)
# img = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY), 如果你自己训练的模型支持灰度图,可以将这句话的注释取消
WenmuZhou's avatar
WenmuZhou committed
369
result = ocr.ocr(img, cls=True)
WenmuZhou's avatar
WenmuZhou committed
370
371
372
373
374
for line in result:
    print(line)

# 显示结果
from PIL import Image
375

WenmuZhou's avatar
WenmuZhou committed
376
377
378
379
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]
WenmuZhou's avatar
WenmuZhou committed
380
im_show = draw_ocr(image, boxes, txts, scores, font_path='/path/to/PaddleOCR/doc/fonts/simfang.ttf')
WenmuZhou's avatar
WenmuZhou committed
381
382
383
384
im_show = Image.fromarray(im_show)
im_show.save('result.jpg')
```

WenmuZhou's avatar
WenmuZhou committed
385
## 5 参数说明
WenmuZhou's avatar
WenmuZhou committed
386
387
388
389
390
391
392

| 字段                    | 说明                                                                                                                                                                                                                 | 默认值                  |
|-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------|
| use_gpu                 | 是否使用GPU                                                                                                                                                                                                          | TRUE                    |
| gpu_mem                 | 初始化占用的GPU内存大小                                                                                                                                                                                              | 8000M                   |
| image_dir               | 通过命令行调用时执行预测的图片或文件夹路径                                                                                                                                                                           |                         |
| det_algorithm           | 使用的检测算法类型                                                                                                                                                                                                   | DB                      |
WenmuZhou's avatar
WenmuZhou committed
393
| det_model_dir          |  检测模型所在文件夹。传参方式有两种,1. None: 自动下载内置模型到 `~/.paddleocr/det`;2.自己转换好的inference模型路径,模型路径下必须包含model和params文件 |   None        |
WenmuZhou's avatar
WenmuZhou committed
394
395
396
397
398
399
400
401
| det_max_side_len        | 检测算法前向时图片长边的最大尺寸,当长边超出这个值时会将长边resize到这个大小,短边等比例缩放                                                                                                                         | 960                     |
| det_db_thresh           | DB模型输出预测图的二值化阈值                                                                                                                                                                                         | 0.3                     |
| det_db_box_thresh       | DB模型输出框的阈值,低于此值的预测框会被丢弃                                                                                                                                                                           | 0.5                     |
| det_db_unclip_ratio     | DB模型输出框扩大的比例                                                                                                                                                                                               | 2                       |
| det_east_score_thresh   | EAST模型输出预测图的二值化阈值                                                                                                                                                                                       | 0.8                     |
| det_east_cover_thresh   | EAST模型输出框的阈值,低于此值的预测框会被丢弃                                                                                                                                                                         | 0.1                     |
| det_east_nms_thresh     | EAST模型输出框NMS的阈值                                                                                                                                                                                              | 0.2                     |
| rec_algorithm           | 使用的识别算法类型                                                                                                                                                                                                   | CRNN                    |
WenmuZhou's avatar
WenmuZhou committed
402
| rec_model_dir          | 识别模型所在文件夹。传参方式有两种,1. None: 自动下载内置模型到 `~/.paddleocr/rec`;2.自己转换好的inference模型路径,模型路径下必须包含model和params文件 | None |
WenmuZhou's avatar
WenmuZhou committed
403
| rec_image_shape         | 识别算法的输入图片尺寸                                                                                                                                                                                             | "3,32,320"              |
WenmuZhou's avatar
WenmuZhou committed
404
| rec_char_type           | 识别算法的字符类型,中英文(ch)、英文(en)、法语(french)、德语(german)、韩语(korean)、日语(japan)                                                                                                                                                                               | ch                      |
WenmuZhou's avatar
WenmuZhou committed
405
| rec_batch_num           | 进行识别时,同时前向的图片数                                                                                                                                                                                         | 30                      |
WenmuZhou's avatar
WenmuZhou committed
406
407
| max_text_length         | 识别算法能识别的最大文字长度                                                                                                                                                                                         | 25                      |
| rec_char_dict_path      | 识别模型字典路径,当rec_model_dir使用方式2传参时需要修改为自己的字典路径                                                                                                                                                | ./ppocr/utils/ppocr_keys_v1.txt                        |
WenmuZhou's avatar
WenmuZhou committed
408
| use_space_char          | 是否识别空格                                                                                                                                                                                                         | TRUE                    |
WenmuZhou's avatar
WenmuZhou committed
409
| drop_score          | 对输出按照分数(来自于识别模型)进行过滤,低于此分数的不返回                                                                                                                                                                                                         | 0.5                    |
WenmuZhou's avatar
WenmuZhou committed
410
411
412
413
414
| use_angle_cls          | 是否加载分类模型                                                                                                                                                                                                         | FALSE                    |
| cls_model_dir          | 分类模型所在文件夹。传参方式有两种,1. None: 自动下载内置模型到 `~/.paddleocr/cls`;2.自己转换好的inference模型路径,模型路径下必须包含model和params文件                                                                                 | None                    |
| cls_image_shape          | 分类算法的输入图片尺寸                                                                           | "3, 48, 192"                    |
| label_list          | 分类算法的标签列表                                                                           | ['0', '180']                  |
| cls_batch_num          | 进行分类时,同时前向的图片数                                                                          |30                 |
WenmuZhou's avatar
WenmuZhou committed
415
| enable_mkldnn           | 是否启用mkldnn                                                                                                                                                                                                       | FALSE                   |
WenmuZhou's avatar
WenmuZhou committed
416
| use_zero_copy_run           | 是否通过zero_copy_run的方式进行前向                                                                                                                                                                               | FALSE                   |
WenmuZhou's avatar
WenmuZhou committed
417
| lang                     | 模型语言类型,目前支持 目前支持中英文(ch)、英文(en)、法语(french)、德语(german)、韩语(korean)、日语(japan)                                                                                                                                                                                               | ch                    |
WenmuZhou's avatar
WenmuZhou committed
418
419
| det                     | 前向时使用启动检测                                                                                                                                                                                                   | TRUE                    |
| rec                     | 前向时是否启动识别                                                                                                                                                                                                   | TRUE                    |
WenmuZhou's avatar
WenmuZhou committed
420
| cls                     | 前向时是否启动分类 (命令行模式下使用use_angle_cls控制前向是否启动分类)                                                                                                                                                                                                | FALSE                    |
WenmuZhou's avatar
WenmuZhou committed
421
| show_log                     | 是否打印det和rec等信息                                                                                                                                                                                                | FALSE                    |
WenmuZhou's avatar
WenmuZhou committed
422
| type                     | 执行ocr或者表格结构化, 值可选['ocr','structure']                                                                                                                                                                                             | ocr                    |