u
This commit is contained in:
1 parent
34deecb157
commit
ba4506baf7
16 files changed
+117
-5
No files matched your search
@@ -0,0 +1,52 @@
|
||||
# 相关网站
|
||||
|
||||
- github:https://github.com/PaddleCV-SIG/PaddleLabel
|
||||
- 官网:
|
||||
|
||||
|
||||
|
||||
# 加载自定义模型
|
||||
|
||||
## 1. 修改 PPOCRLabel.py
|
||||
|
||||
```python
|
||||
params = {
|
||||
"use_doc_orientation_classify": False,
|
||||
"use_doc_unwarping": False,
|
||||
"use_textline_orientation": True,
|
||||
"device": self.gpu,
|
||||
"lang": self.lang,
|
||||
"text_detection_model_name": "PP-OCRv5_mobile_det", # 修改为自己的模型名称
|
||||
"text_recognition_model_name": "PP-OCRv5_mobile_rec", # 修改为自己的模型名称
|
||||
"enable_mkldnn": False,
|
||||
}
|
||||
|
||||
if det_model_dir is not None:
|
||||
params["text_detection_model_dir"] = det_model_dir
|
||||
if rec_model_dir is not None:
|
||||
params["text_recognition_model_dir"] = rec_model_dir
|
||||
if cls_model_dir is not None:
|
||||
params["text_line_orientation_model_dir"] = cls_model_dir
|
||||
|
||||
self.ocr = PaddleOCR(**params)
|
||||
self.text_recognizer = TextRecognition(
|
||||
model_name="PP-OCRv5_mobile_rec", # 修改为自己的模型名称
|
||||
model_dir=rec_model_dir,
|
||||
device=self.gpu,
|
||||
)
|
||||
self.text_detector = TextDetection(
|
||||
model_name="PP-OCRv5_mobile_det", # 修改为自己的模型名称
|
||||
model_dir=det_model_dir,
|
||||
device=self.gpu,
|
||||
)
|
||||
```
|
||||
|
||||
## 修改启动命令
|
||||
|
||||
```bash
|
||||
python PPOCRLabel.py --lang ch --kie True --det_model_dir "模型路径" --rec_model_dir "模型路径"
|
||||
|
||||
# 示例
|
||||
python PPOCRLabel.py --lang ch --kie True --det_model_dir ".\model\det_inference\" --rec_model_dir ".\model\rec_inference\"
|
||||
```
|
||||
|
||||
Reference in new issue
Block a user