PaddlePaddle/PaddleOCR · error · ValueError
{model_name} is not supported. Please check if the model is
Error message
{model_name} is not supported. Please check if the model is supported by the PaddleOCR wheel. What it means
TextDetector (tools/infer/predict_det.py) reads inference.yml from the detection model directory and rejects models whose Global.model_name is not in the wheel whitelist: PP-OCRv5/v6 mobile, server, tiny, small, medium det models. The gate only fires when inference.yml exists; models shipped without it (the traditional tar balls from the model zoo) are not checked. Its purpose is to stop users from using unsupported det models with the pip wheel, where preprocessing is hard-wired to the supported architectures.
Source
Thrown at tools/infer/predict_det.py:48
from ppocr.utils.utility import get_image_file_list, check_and_read
from ppocr.data import create_operators, transform
from ppocr.postprocess import build_post_process
import json
class TextDetector(object):
def __init__(self, args, logger=None):
if os.path.exists(f"{args.det_model_dir}/inference.yml"):
model_config = utility.load_config(f"{args.det_model_dir}/inference.yml")
model_name = model_config.get("Global", {}).get("model_name", "")
if model_name and model_name not in [
"PP-OCRv5_mobile_det",
"PP-OCRv5_server_det",
"PP-OCRv6_tiny_det",
"PP-OCRv6_small_det",
"PP-OCRv6_medium_det",
]:
raise ValueError(
f"{model_name} is not supported. Please check if the model is supported by the PaddleOCR wheel."
)
if logger is None:
logger = get_logger()
self.args = args
self.det_algorithm = args.det_algorithm
self.use_onnx = args.use_onnx
pre_process_list = [
{
"DetResizeForTest": {
"limit_side_len": args.det_limit_side_len,
"limit_type": args.det_limit_type,
}
},
{
"NormalizeImage": {
"std": [0.229, 0.224, 0.225],View on GitHub (pinned to 2661c7c0ef)
Solutions
- Use a whitelisted model: PP-OCRv5_mobile_det, PP-OCRv5_server_det, PP-OCRv6_tiny/small/medium_det
- For older models, download the classic zoo packages that lack inference.yml (gate is skipped)
- Only if the architecture truly matches, rename Global.model_name inside the model's inference.yml to a whitelisted entry
- Build PaddleOCR from source instead of the wheel if you must run non-whitelisted det models
Example fix
# before --det_model_dir=./inference/PP-OCRv4_mobile_det # ValueError # after --det_model_dir=./inference/PP-OCRv5_mobile_det
Defensive patterns
Strategy: validation
Validate before calling
import os, yaml
SUPPORTED_DET = {'PP-OCRv5_mobile_det','PP-OCRv5_server_det','PP-OCRv6_tiny_det','PP-OCRv6_small_det','PP-OCRv6_medium_det'}
yml = os.path.join(det_model_dir, 'inference.yml')
if os.path.exists(yml):
name = yaml.safe_load(open(yml)).get('Global', {}).get('model_name', '')
assert not name or name in SUPPORTED_DET, f'det model {name!r} unsupported' Try / catch
try:
det = TextDetector(args)
except ValueError as e:
if 'not supported' in str(e):
raise SystemExit('use a PP-OCRv5/v6 det model or a legacy package without inference.yml')
raise Prevention
- Smoke-test model loading in CI with the exact model dirs used in production
- When upgrading the PaddleOCR wheel, re-check the supported model list in the changelog
When it happens
Trigger: Setting --det_model_dir to a DB/PP-OCRv4/EAST/advanced det model that ships an inference.yml with a non-whitelisted model_name (e.g. 'PP-OCRv4_mobile_det', 'det_mv3_db').
Common situations: Migrating an old project that used PP-OCRv3/v4 det models to the new wheel; downloading 'latest' det models whose metadata names differ from the whitelist; fine-tuned det models re-exported with their original model_name.
Related errors
- {model_name} is not supported. Please check if the model is
- {model_name} is not supported. Please check if the model is
- {model_name} is not supported. Please check if the model is
- {model_name} is not supported. Please check if the model is
- Detection model session is not initialized.
AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14).
Data as JSON: /api/errors/0ffffe7e03ad930f.
Report an issue: GitHub.