PaddlePaddle/PaddleOCR · error · NotImplementedError
mode[{model_name}_model] is not implemented!
Error message
mode[{model_name}_model] is not implemented! What it means
The MobileNetV3 detection backbone selects its inverted-residual block table by model_name and only implements 'large' and 'small' (the SOURCE shows the tail of the 'small' table, cls_ch_squeeze=576). Any other value raises NotImplementedError with the message 'mode[<name>_model] is not implemented!'. Note the message is slightly misleading — it is model_name, not 'mode', that is wrong.
Source
Thrown at ppocr/modeling/backbones/det_mobilenet_v3.py:87
cls_ch_squeeze = 960
elif model_name == "small":
cfg = [
# k, exp, c, se, nl, s,
[3, 16, 16, True, "relu", 2],
[3, 72, 24, False, "relu", 2],
[3, 88, 24, False, "relu", 1],
[5, 96, 40, True, "hardswish", 2],
[5, 240, 40, True, "hardswish", 1],
[5, 240, 40, True, "hardswish", 1],
[5, 120, 48, True, "hardswish", 1],
[5, 144, 48, True, "hardswish", 1],
[5, 288, 96, True, "hardswish", 2],
[5, 576, 96, True, "hardswish", 1],
[5, 576, 96, True, "hardswish", 1],
]
cls_ch_squeeze = 576
else:
raise NotImplementedError(
"mode[" + model_name + "_model] is not implemented!"
)
supported_scale = [0.35, 0.5, 0.75, 1.0, 1.25]
assert (
scale in supported_scale
), "supported scale are {} but input scale is {}".format(supported_scale, scale)
inplanes = 16
# conv1
self.conv = ConvBNLayer(
in_channels=in_channels,
out_channels=make_divisible(inplanes * scale),
kernel_size=3,
stride=2,
padding=1,
groups=1,
if_act=True,
act="hardswish",View on GitHub (pinned to 2661c7c0ef)
Solutions
- Set model_name: large or model_name: small (lowercase) in the det_mobilenet_v3 backbone config
- Check for a capitalized variant like 'Large' — the comparison is case-sensitive
- Confirm scale is also one of 0.35/0.5/0.75/1.0/1.25, since the next line asserts it
Example fix
# before Backbone: name: MobileNetV3 model_name: Medium # after Backbone: name: MobileNetV3 model_name: small
Defensive patterns
Strategy: validation
Validate before calling
model_name = model_name.lower()
assert model_name in ('large', 'small'), f"model_name must be 'large' or 'small', got {model_name!r}"
backbone = MobileNetV3(model_name=model_name, scale=scale) Type guard
def is_mobilenet_v3_name(n: str) -> bool:
return isinstance(n, str) and n.lower() in ('large', 'small') Prevention
- Lowercase model_name defensively before passing it into the backbone
- When copying configs between det and rec models, keep the model_name/scale keys consistent
- Also pre-check scale in {0.35, 0.5, 0.75, 1.0, 1.25}
When it happens
Trigger: Backbone config Backbone.name=MobileNetV3 with model_name='medium', 'Large' (capitalized), or None; the exception fires during network construction.
Common situations: Copying a recognition MobileNetV3 config into a detection config (or vice versa) with an extra/renamed key; case-sensitive typos; assuming intermediate widths exist.
Related errors
- mode[{model_name}_model] is not implemented!
- main_loss_type in BalanceLoss() can only be one of {}
- [DBLoss]: Unrecognized main loss type!
- mode[{mode}_model] is not implemented!
- The mixer must be one of [Global, Local, Conv]
AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14).
Data as JSON: /api/errors/88d79b0d10450bc2.
Report an issue: GitHub.