Skip to content

Commit 6d2110b

Browse files
fix v6 docs (#18209)
1 parent 1af0448 commit 6d2110b

2 files changed

Lines changed: 26 additions & 14 deletions

File tree

docs/version3.x/pipeline_usage/OCR.en.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,24 +1287,26 @@ If `save_path` is specified, the visualization results will be saved under `save
12871287

12881288
The command-line method is for quick testing. For project integration, you can achieve OCR inference with just a few lines of code:
12891289

1290-
```python
1291-
from paddleocr import PaddleOCR
1290+
```python
1291+
from paddleocr import PaddleOCR
12921292

1293+
# Uses PP-OCRv6 models by default
12931294
ocr = PaddleOCR(
12941295
use_doc_orientation_classify=False, # Disables document orientation classification model via this parameter
12951296
use_doc_unwarping=False, # Disables text image rectification model via this parameter
12961297
use_textline_orientation=False, # Disables text line orientation classification model via this parameter
12971298
)
12981299
# ocr = PaddleOCR(lang="en") # Uses English model by specifying language parameter
1299-
# ocr = PaddleOCR(ocr_version="PP-OCRv4") # Uses other PP-OCR versions via version parameter
1300+
# ocr = PaddleOCR(ocr_version="PP-OCRv5") # Switches to PP-OCRv5 version via ocr_version parameter
1301+
# ocr = PaddleOCR(ocr_version="PP-OCRv4") # Switches to PP-OCRv4 version via ocr_version parameter
13001302
# ocr = PaddleOCR(device="gpu") # Enables GPU acceleration for model inference via device parameter
13011303
# ocr = PaddleOCR(
13021304
# text_detection_model_name="PP-OCRv5_mobile_det",
13031305
# text_recognition_model_name="PP-OCRv5_mobile_rec",
13041306
# use_doc_orientation_classify=False,
13051307
# use_doc_unwarping=False,
13061308
# use_textline_orientation=False,
1307-
# ) # Switch to PP-OCRv5_mobile models
1309+
# ) # Switch to PP-OCRv5 mobile models
13081310
result = ocr.predict("./general_ocr_002.png")
13091311
for res in result:
13101312
res.print()
@@ -2625,14 +2627,16 @@ If you choose `transformers` as the inference engine, make sure the Transformers
26252627
```python
26262628
from paddleocr import PaddleOCR
26272629

2630+
# Uses PP-OCRv6 models by default
26282631
ocr = PaddleOCR(
26292632
use_doc_orientation_classify=False, # Disable document orientation classification
26302633
use_doc_unwarping=False, # Disable document unwarping
26312634
use_textline_orientation=False, # Disable textline orientation classification
26322635
engine="transformers",
26332636
)
26342637
# ocr = PaddleOCR(lang="en", engine="transformers") # Use the English model
2635-
# ocr = PaddleOCR(ocr_version="PP-OCRv4", engine="transformers") # Use another PP-OCR version
2638+
# ocr = PaddleOCR(ocr_version="PP-OCRv5", engine="transformers") # Switch to PP-OCRv5 version
2639+
# ocr = PaddleOCR(ocr_version="PP-OCRv4", engine="transformers") # Switch to PP-OCRv4 version
26362640
# ocr = PaddleOCR(device="gpu", engine="transformers") # Use GPU for inference
26372641
# ocr = PaddleOCR(
26382642
# text_detection_model_name="PP-OCRv5_server_det",
@@ -2641,7 +2645,7 @@ ocr = PaddleOCR(
26412645
# use_doc_unwarping=False,
26422646
# use_textline_orientation=False,
26432647
# engine="transformers",
2644-
# ) # Switch to the PP-OCRv5_server models
2648+
# ) # Switch to PP-OCRv5 server models
26452649
result = ocr.predict("./general_ocr_002.png")
26462650
for res in result:
26472651
res.print()
@@ -2654,14 +2658,16 @@ If you choose `onnxruntime` as the inference engine, make sure the ONNX Runtime
26542658
```python
26552659
from paddleocr import PaddleOCR
26562660

2661+
# Uses PP-OCRv6 models by default
26572662
ocr = PaddleOCR(
26582663
use_doc_orientation_classify=False, # Disable document orientation classification
26592664
use_doc_unwarping=False, # Disable document unwarping
26602665
use_textline_orientation=False, # Disable textline orientation classification
26612666
engine="onnxruntime",
26622667
)
26632668
# ocr = PaddleOCR(lang="en", engine="onnxruntime") # Use the English model
2664-
# ocr = PaddleOCR(ocr_version="PP-OCRv4", engine="onnxruntime") # Use another PP-OCR version
2669+
# ocr = PaddleOCR(ocr_version="PP-OCRv5", engine="onnxruntime") # Switch to PP-OCRv5 version
2670+
# ocr = PaddleOCR(ocr_version="PP-OCRv4", engine="onnxruntime") # Switch to PP-OCRv4 version
26652671
# ocr = PaddleOCR(device="gpu", engine="onnxruntime") # Use GPU for inference
26662672
# ocr = PaddleOCR(
26672673
# text_detection_model_name="PP-OCRv5_server_det",
@@ -2670,7 +2676,7 @@ ocr = PaddleOCR(
26702676
# use_doc_unwarping=False,
26712677
# use_textline_orientation=False,
26722678
# engine="onnxruntime",
2673-
# ) # Switch to the PP-OCRv5_server models
2679+
# ) # Switch to PP-OCRv5 server models
26742680
result = ocr.predict("./general_ocr_002.png")
26752681
for res in result:
26762682
res.print()

docs/version3.x/pipeline_usage/OCR.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,21 +1274,23 @@ paddleocr ocr -i https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_im
12741274
```python
12751275
from paddleocr import PaddleOCR
12761276

1277+
# 默认使用 PP-OCRv6 模型
12771278
ocr = PaddleOCR(
12781279
use_doc_orientation_classify=False, # 通过 use_doc_orientation_classify 参数指定不使用文档方向分类模型
12791280
use_doc_unwarping=False, # 通过 use_doc_unwarping 参数指定不使用文本图像矫正模型
12801281
use_textline_orientation=False, # 通过 use_textline_orientation 参数指定不使用文本行方向分类模型
12811282
)
12821283
# ocr = PaddleOCR(lang="en") # 通过 lang 参数来使用英文模型
1283-
# ocr = PaddleOCR(ocr_version="PP-OCRv4") # 通过 ocr_version 参数来使用 PP-OCR 其他版本
1284+
# ocr = PaddleOCR(ocr_version="PP-OCRv5") # 通过 ocr_version 参数切换为 PP-OCRv5 版本
1285+
# ocr = PaddleOCR(ocr_version="PP-OCRv4") # 通过 ocr_version 参数切换为 PP-OCRv4 版本
12841286
# ocr = PaddleOCR(device="gpu") # 通过 device 参数使得在模型推理时使用 GPU
12851287
# ocr = PaddleOCR(
12861288
# text_detection_model_name="PP-OCRv5_server_det",
12871289
# text_recognition_model_name="PP-OCRv5_server_rec",
12881290
# use_doc_orientation_classify=False,
12891291
# use_doc_unwarping=False,
12901292
# use_textline_orientation=False,
1291-
# ) # 更换 PP-OCRv5_server 模型
1293+
# ) # 使用 PP-OCRv5 的 server 模型
12921294
result = ocr.predict("./general_ocr_002.png")
12931295
for res in result:
12941296
res.print()
@@ -1303,14 +1305,16 @@ for res in result:
13031305
```python
13041306
from paddleocr import PaddleOCR
13051307

1308+
# 默认使用 PP-OCRv6 模型
13061309
ocr = PaddleOCR(
13071310
use_doc_orientation_classify=False, # 通过 use_doc_orientation_classify 参数指定不使用文档方向分类模型
13081311
use_doc_unwarping=False, # 通过 use_doc_unwarping 参数指定不使用文本图像矫正模型
13091312
use_textline_orientation=False, # 通过 use_textline_orientation 参数指定不使用文本行方向分类模型
13101313
engine="transformers",
13111314
)
13121315
# ocr = PaddleOCR(lang="en", engine="transformers") # 通过 lang 参数来使用英文模型
1313-
# ocr = PaddleOCR(ocr_version="PP-OCRv4", engine="transformers") # 通过 ocr_version 参数来使用 PP-OCR 其他版本
1316+
# ocr = PaddleOCR(ocr_version="PP-OCRv5", engine="transformers") # 通过 ocr_version 参数切换为 PP-OCRv5 版本
1317+
# ocr = PaddleOCR(ocr_version="PP-OCRv4", engine="transformers") # 通过 ocr_version 参数切换为 PP-OCRv4 版本
13141318
# ocr = PaddleOCR(device="gpu", engine="transformers") # 通过 device 参数使得在模型推理时使用 GPU
13151319
# ocr = PaddleOCR(
13161320
# text_detection_model_name="PP-OCRv5_server_det",
@@ -1319,7 +1323,7 @@ ocr = PaddleOCR(
13191323
# use_doc_unwarping=False,
13201324
# use_textline_orientation=False,
13211325
# engine="transformers",
1322-
# ) # 更换 PP-OCRv5_server 模型
1326+
# ) # 使用 PP-OCRv5 的 server 模型
13231327
result = ocr.predict("./general_ocr_002.png")
13241328
for res in result:
13251329
res.print()
@@ -1332,14 +1336,16 @@ for res in result:
13321336
```python
13331337
from paddleocr import PaddleOCR
13341338

1339+
# 默认使用 PP-OCRv6 模型
13351340
ocr = PaddleOCR(
13361341
use_doc_orientation_classify=False, # 通过 use_doc_orientation_classify 参数指定不使用文档方向分类模型
13371342
use_doc_unwarping=False, # 通过 use_doc_unwarping 参数指定不使用文本图像矫正模型
13381343
use_textline_orientation=False, # 通过 use_textline_orientation 参数指定不使用文本行方向分类模型
13391344
engine="onnxruntime",
13401345
)
13411346
# ocr = PaddleOCR(lang="en", engine="onnxruntime") # 通过 lang 参数来使用英文模型
1342-
# ocr = PaddleOCR(ocr_version="PP-OCRv4", engine="onnxruntime") # 通过 ocr_version 参数来使用 PP-OCR 其他版本
1347+
# ocr = PaddleOCR(ocr_version="PP-OCRv5", engine="onnxruntime") # 通过 ocr_version 参数切换为 PP-OCRv5 版本
1348+
# ocr = PaddleOCR(ocr_version="PP-OCRv4", engine="onnxruntime") # 通过 ocr_version 参数切换为 PP-OCRv4 版本
13431349
# ocr = PaddleOCR(device="gpu", engine="onnxruntime") # 通过 device 参数使得在模型推理时使用 GPU
13441350
# ocr = PaddleOCR(
13451351
# text_detection_model_name="PP-OCRv5_server_det",
@@ -1348,7 +1354,7 @@ ocr = PaddleOCR(
13481354
# use_doc_unwarping=False,
13491355
# use_textline_orientation=False,
13501356
# engine="onnxruntime",
1351-
# ) # 更换 PP-OCRv5_server 模型
1357+
# ) # 使用 PP-OCRv5 的 server 模型
13521358
result = ocr.predict("./general_ocr_002.png")
13531359
for res in result:
13541360
res.print()

0 commit comments

Comments
 (0)