PaddleOCR icon indicating copy to clipboard operation
PaddleOCR copied to clipboard

python3 tools/infer/predict_rec.py 推理失败

Open cqray1990 opened this issue 7 months ago • 3 comments

🔎 Search before asking

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

🐛 Bug (问题描述)

raise ValueError(

ValueError: arabic_PP-OCRv3_mobile_rec is not supported. Please check if the model is supported by the PaddleOCR wheel.

🏃‍♂️ Environment (运行环境)

paddleocr 3.0

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

python3 tools/infer/predict_rec.py --image_dir="general_ocr_rec_010_arabic.png" --rec_model_dir=arabic_PP-OCRv3_mobile_rec_infer" --rec_image_shape="3, 48, 320" --rec_char_dict_path=/ppocr/utils/dict/arabic_dict.txt"

cqray1990 avatar May 21 '25 10:05 cqray1990

+1

zhaop-l avatar May 28 '25 06:05 zhaop-l

在tools/infer/predict_rec.py脚本中, 原始的是: if model_name and model_name not in [ "PP-OCRv5_mobile_rec", "PP-OCRv5_server_rec", ]: 第47行开始添加需要的模型名字可以,修改为以下代码: class TextRecognizer(object): def __init__(self, args, logger=None): if os.path.exists(f"{args.rec_model_dir}/inference.yml"): model_config = utility.load_config(f"{args.rec_model_dir}/inference.yml") model_name = model_config.get("Global", {}).get("model_name", "") if model_name and model_name not in [ "PP-OCRv5_mobile_rec", "PP-OCRv5_server_rec", "PP-OCRv4_mobile_rec", "PP-OCRv4_server_rec", "PP-OCRv4_server_rec_doc", ]: raise ValueError( f"{model_name} is not supported. Please check if the model is supported by the PaddleOCR wheel." )

xueqin84 avatar May 29 '25 02:05 xueqin84

在tools/infer/predict_rec.py脚本中, 原始的是: if model_name and model_name not in [ "PP-OCRv5_mobile_rec", "PP-OCRv5_server_rec", ]: 第47行开始添加需要的模型名字可以,修改为以下代码: class TextRecognizer(object): def __init__(self, args, logger=None): if os.path.exists(f"{args.rec_model_dir}/inference.yml"): model_config = utility.load_config(f"{args.rec_model_dir}/inference.yml") model_name = model_config.get("Global", {}).get("model_name", "") if model_name and model_name not in [ "PP-OCRv5_mobile_rec", "PP-OCRv5_server_rec", "PP-OCRv4_mobile_rec", "PP-OCRv4_server_rec", "PP-OCRv4_server_rec_doc", ]: raise ValueError( f"{model_name} is not supported. Please check if the model is supported by the PaddleOCR wheel." )

尝试这个方法了吗,是可以解决的

zhangyubo0722 avatar Jun 03 '25 08:06 zhangyubo0722

The issue has no response for a long time and will be closed. You can reopen or new another issue if are still confused.


From Bot

TingquanGao avatar Jul 04 '25 12:07 TingquanGao