Skip to content

PaddleOCR 设置text_detection_model_name='PP-OCRv5_server_det', text_recognition_model_name='PP-OCRv5_server_rec',但实际调用的是PP-OCRv5_mobile_det,PP-OCRv5_mobile_rec #15481

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
xndm-tech opened this issue May 29, 2025 · 1 comment · Fixed by #15485

Comments

@xndm-tech
Copy link

🔎 Search before asking

  • I have searched the PaddleOCR Docs and found no similar bug report.
  • I have searched the PaddleOCR Issues and found no similar bug report.
  • I have searched the PaddleOCR Discussions and found no similar bug report.

🐛 Bug (问题描述)

当PaddleOCR的构造函数里同时设置了
text_detection_model_name
text_recognition_model_name
lang
需要查看最终调用的模型是否正确,测试显示,会打印
Creating model: ('PP-OCRv5_mobile_det', None)
Using official model (PP-OCRv5_mobile_det), the model files will be automatically downloaded and saved in /home//.paddlex/official_models.
Creating model: ('PP-OCRv5_mobile_rec', None)
Using official model (PP-OCRv5_mobile_rec), the model files will be automatically downloaded and saved in /home/
/.paddlex/official_models.

原因为https://github.com/PaddlePaddle/PaddleOCR/tree/main/paddleocr/_pipelines/ocr.py
代码里有这样一段
if text_detection_model_dir is None and text_recognition_model_dir is None:
if lang is not None or ocr_version is not None:
det_model_name, rec_model_name = self._get_ocr_model_names(
lang, ocr_version
)
if det_model_name is None or rec_model_name is None:
raise ValueError(
f"No models are available for the language {repr(lang)} and OCR version {repr(ocr_version)}."
)
text_detection_model_name = det_model_name
text_recognition_model_name = rec_model_name
直接把模型给改了。

🏃‍♂️ Environment (运行环境)

代码层面的问题,与环境无关

🌰 Minimal Reproducible Example (最小可复现问题的Demo)

代码层面的问题,与环境无关,直接看代码即可发现问题

@Bobholamovic
Copy link
Member

你好,这几个参数在语义上有些冲突,当同时指定时,行为可能有些违反直觉。感谢你指出这个问题,我们将在代码中增加检查,使代码行为更符合用户期待

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants