Skip to content

Commit 4d406f8

Browse files
committed
update whl for rec image shape
1 parent 399a635 commit 4d406f8

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

doc/doc_ch/whl.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,10 @@ for line in result:
199199
paddleocr -h
200200
```
201201
202-
**注意** whl包默认使用`PP-OCRv3`模型,识别模型使用的输入shape为`3,48,320`, 因此如果使用识别功能,需要添加参数`--rec_image_shape 3,48,320`,如果不使用默认的`PP-OCRv3`模型,则无需设置该参数。
203-
204202
* 检测+方向分类器+识别全流程
205203
206204
```bash
207-
paddleocr --image_dir PaddleOCR/doc/imgs/11.jpg --use_angle_cls true --rec_image_shape 3,48,320
205+
paddleocr --image_dir PaddleOCR/doc/imgs/11.jpg --use_angle_cls true
208206
```
209207
210208
结果是一个list,每个item包含了文本框,文字和识别置信度
@@ -217,7 +215,7 @@ paddleocr --image_dir PaddleOCR/doc/imgs/11.jpg --use_angle_cls true --rec_image
217215
* 检测+识别
218216
219217
```bash
220-
paddleocr --image_dir PaddleOCR/doc/imgs/11.jpg --rec_image_shape 3,48,320
218+
paddleocr --image_dir PaddleOCR/doc/imgs/11.jpg
221219
```
222220
223221
结果是一个list,每个item包含了文本框,文字和识别置信度
@@ -230,7 +228,7 @@ paddleocr --image_dir PaddleOCR/doc/imgs/11.jpg --rec_image_shape 3,48,320
230228
* 方向分类器+识别
231229
232230
```bash
233-
paddleocr --image_dir PaddleOCR/doc/imgs_words/ch/word_1.jpg --use_angle_cls true --det false --rec_image_shape 3,48,320
231+
paddleocr --image_dir PaddleOCR/doc/imgs_words/ch/word_1.jpg --use_angle_cls true --det false
234232
```
235233
236234
结果是一个list,每个item只包含识别结果和识别置信度
@@ -256,7 +254,7 @@ paddleocr --image_dir PaddleOCR/doc/imgs/11.jpg --rec false
256254
* 单独执行识别
257255
258256
```bash
259-
paddleocr --image_dir PaddleOCR/doc/imgs_words/ch/word_1.jpg --det false --rec_image_shape 3,48,320
257+
paddleocr --image_dir PaddleOCR/doc/imgs_words/ch/word_1.jpg --det false
260258
```
261259
262260
结果是一个list,每个item只包含识别结果和识别置信度

doc/doc_en/whl_en.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,9 @@ show help information
172172
paddleocr -h
173173
```
174174
175-
**Note**: The whl package uses the `PP-OCRv3` model by default, and the input shape used by the recognition model is `3,48,320`, so if you use the recognition function, you need to add the parameter `--rec_image_shape 3,48,320`, if you do not use the default `PP- OCRv3` model, you do not need to set this parameter.
176-
177175
* detection classification and recognition
178176
```bash
179-
paddleocr --image_dir PaddleOCR/doc/imgs_en/img_12.jpg --use_angle_cls true --lang en --rec_image_shape 3,48,320
177+
paddleocr --image_dir PaddleOCR/doc/imgs_en/img_12.jpg --use_angle_cls true --lang en
180178
```
181179
182180
Output will be a list, each item contains bounding box, text and recognition confidence
@@ -189,7 +187,7 @@ Output will be a list, each item contains bounding box, text and recognition con
189187
190188
* detection and recognition
191189
```bash
192-
paddleocr --image_dir PaddleOCR/doc/imgs_en/img_12.jpg --lang en --rec_image_shape 3,48,320
190+
paddleocr --image_dir PaddleOCR/doc/imgs_en/img_12.jpg --lang en
193191
```
194192
195193
Output will be a list, each item contains bounding box, text and recognition confidence
@@ -202,7 +200,7 @@ Output will be a list, each item contains bounding box, text and recognition con
202200
203201
* classification and recognition
204202
```bash
205-
paddleocr --image_dir PaddleOCR/doc/imgs_words_en/word_10.png --use_angle_cls true --det false --lang en --rec_image_shape 3,48,320
203+
paddleocr --image_dir PaddleOCR/doc/imgs_words_en/word_10.png --use_angle_cls true --det false --lang en
206204
```
207205
208206
Output will be a list, each item contains text and recognition confidence
@@ -225,7 +223,7 @@ Output will be a list, each item only contains bounding box
225223
226224
* only recognition
227225
```bash
228-
paddleocr --image_dir PaddleOCR/doc/imgs_words_en/word_10.png --det false --lang en --rec_image_shape 3,48,320
226+
paddleocr --image_dir PaddleOCR/doc/imgs_words_en/word_10.png --det false --lang en
229227
```
230228
231229
Output will be a list, each item contains text and recognition confidence

paddleocr.py

+4
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,10 @@ def __init__(self, **kwargs):
412412
params.cls_model_dir, cls_url = confirm_model_dir_url(
413413
params.cls_model_dir,
414414
os.path.join(BASE_DIR, 'whl', 'cls'), cls_model_config['url'])
415+
if params.ocr_version == 'PP-OCRv3':
416+
params.rec_image_shape = "3, 48, 320"
417+
else:
418+
params.rec_image_shape = "3, 32, 320"
415419
# download model
416420
maybe_download(params.det_model_dir, det_url)
417421
maybe_download(params.rec_model_dir, rec_url)

0 commit comments

Comments
 (0)