PaddlePaddle/PaddleOCR · error · NotImplementedError

mode[{model_name}_model] is not implemented!

Error message

mode[{model_name}_model] is not implemented!

What it means

MobileNetV3 recognition backbone mirrors the detection variant: only model_name 'large' and 'small' have block tables (SOURCE ends the 'small' table with cls_ch_squeeze=576). Any other model_name raises NotImplementedError('mode[<name>_model] is not implemented!') during network build; the immediately following assert then validates scale in {0.35, 0.5, 0.75, 1.0, 1.25}.

Source

Thrown at ppocr/modeling/backbones/rec_mobilenet_v3.py:94

            cls_ch_squeeze = 960
        elif model_name == "small":
            cfg = [
                # k, exp, c,  se,     nl,  s,
                [3, 16, 16, True, "relu", (small_stride[0], 1)],
                [3, 72, 24, False, "relu", (small_stride[1], 1)],
                [3, 88, 24, False, "relu", 1],
                [5, 96, 40, True, "hardswish", (small_stride[2], 1)],
                [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", (small_stride[3], 1)],
                [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 scales are {} but input scale is {}".format(
            supported_scale, scale
        )

        inplanes = 16
        # conv1
        self.conv1 = ConvBNLayer(
            in_channels=in_channels,
            out_channels=make_divisible(inplanes * scale),
            kernel_size=3,
            stride=2,
            padding=1,

View on GitHub (pinned to 2661c7c0ef)

Solutions

  1. Set model_name: large or model_name: small (exact lowercase) in the rec_mobilenet_v3 config
  2. Also verify scale is one of 0.35/0.5/0.75/1.0/1.25 to pass the next assertion

Example fix

# before
Backbone:
  name: MobileNetV3
  model_name: Large

# after
Backbone:
  name: MobileNetV3
  model_name: large
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}"

Type guard

def is_mobilenet_v3_name(n: str) -> bool:
    return isinstance(n, str) and n.lower() in ('large', 'small')

Prevention

When it happens

Trigger: Rec backbone config with model_name='Large' (case-sensitive), 'medium', or missing model_name; or editing small_stride lists but not model_name, resulting in an unused/wrong variant name.

Common situations: Config drift between det and rec MobileNetV3 blocks; capitalization typos; removing model_name while copying a minimal config.

Related errors


AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14). Data as JSON: /api/errors/6b7a7da7b2d19c91. Report an issue: GitHub.