@@ -1740,7 +1740,40 @@ for i, res in enumerate(result["ocrResults"]):
1740
1740
</table >
1741
1741
1742
1742
### 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
+
1744
1777
1745
1778
1 . 获取产线配置文件
1746
1779
@@ -1766,7 +1799,7 @@ SubModules:
1766
1799
limit_type : max
1767
1800
max_side_limit : 4000
1768
1801
model_dir : null # 替换为微调后的文本测模型权重路径
1769
- model_name : PP-OCRv5_server_det
1802
+ model_name : PP-OCRv5_server_det # 如果微调的模型名称与默认模型名称不同,请一并修改此处
1770
1803
module_name : text_detection
1771
1804
thresh : 0.3
1772
1805
unclip_ratio : 1.5
@@ -1778,7 +1811,7 @@ SubModules:
1778
1811
TextRecognition :
1779
1812
batch_size : 6
1780
1813
model_dir : null # 替换为微调后的文本识模型权重路径
1781
- model_name : PP-OCRv5_server_rec
1814
+ model_name : PP-OCRv5_server_rec # 如果微调的模型名称与默认模型名称不同,请一并修改此处
1782
1815
module_name : text_recognition
1783
1816
score_thresh : 0.0
1784
1817
......
0 commit comments