Skip to content

Commit 9d68aa7

Browse files
authored
ocr_model_app (PaddlePaddle#15311)
1 parent 0157a77 commit 9d68aa7

File tree

1 file changed

+36
-3
lines changed
  • docs/version3.x/pipeline_usage

1 file changed

+36
-3
lines changed

docs/version3.x/pipeline_usage/OCR.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,7 +1740,40 @@ for i, res in enumerate(result["ocrResults"]):
17401740
</table>
17411741

17421742
### 4.2 模型应用
1743-
当您使用私有数据集完成微调训练后,可获得本地模型权重文件,然后可以通过自定义产线配置文件的方式,使用微调后的模型权重。
1743+
1744+
当您使用私有数据集完成微调训练后,可获得本地模型权重文件,然后可以通过参数指定本地模型保存路径的方式,或者通过自定义产线配置文件的方式,使用微调后的模型权重。
1745+
1746+
#### 4.2.1 通过参数指定本地模型路径
1747+
1748+
在初始化产线对象时,通过参数指定本地模型路径。以文本检测模型微调后的权重的使用方法为例,示例如下:
1749+
1750+
命令行方式:
1751+
1752+
```bash
1753+
# 通过 --text_detection_model_dir 指定本地模型路径
1754+
paddleocr ocr -i ./general_ocr_002.png --text_detection_model_dir yours_det_model_path
1755+
1756+
# 默认使用 PP-OCRv5_mobile_det 模型作为默认文本检测模型,如果微调的不是该模型,通过 --text_detection_model_name 修改模型名称
1757+
paddleocr ocr -i ./general_ocr_002.png --text_detection_model_name PP-OCRv5_server_det --text_detection_model_dir yours_v5_server_det_model_path
1758+
```
1759+
1760+
脚本方式:
1761+
1762+
```python
1763+
1764+
from paddleocr import PaddleOCR
1765+
1766+
# 通过 text_detection_model_dir 指定本地模型路径
1767+
pipeline = PaddleOCR(text_detection_model_dir="./yours_det_model_path")
1768+
1769+
# 默认使用 PP-OCRv5_mobile_det 模型作为默认文本检测模型,如果微调的不是该模型,通过 text_detection_model_name 修改模型名称
1770+
# pipeline = PaddleOCR(text_detection_model_name="PP-OCRv5_server_det", text_detection_model_dir="./yours_v5_server_det_model_path")
1771+
1772+
```
1773+
1774+
1775+
#### 4.2.2 通过配置文件指定本地模型路径
1776+
17441777

17451778
1. 获取产线配置文件
17461779

@@ -1766,7 +1799,7 @@ SubModules:
17661799
limit_type: max
17671800
max_side_limit: 4000
17681801
model_dir: null # 替换为微调后的文本测模型权重路径
1769-
model_name: PP-OCRv5_server_det
1802+
model_name: PP-OCRv5_server_det # 如果微调的模型名称与默认模型名称不同,请一并修改此处
17701803
module_name: text_detection
17711804
thresh: 0.3
17721805
unclip_ratio: 1.5
@@ -1778,7 +1811,7 @@ SubModules:
17781811
TextRecognition:
17791812
batch_size: 6
17801813
model_dir: null # 替换为微调后的文本识模型权重路径
1781-
model_name: PP-OCRv5_server_rec
1814+
model_name: PP-OCRv5_server_rec # 如果微调的模型名称与默认模型名称不同,请一并修改此处
17821815
module_name: text_recognition
17831816
score_thresh: 0.0
17841817
......

0 commit comments

Comments
 (0)