PaddlePaddle/PaddleOCR · error · NotImplementedError
mode[{mode}_model] is not implemented!
Error message
mode[{mode}_model] is not implemented! What it means
MicroNet recognition backbone implements four fixed architectures selected by the mode string: 'M0', 'M1', 'M2', 'M3' (the SOURCE shows the M2/M3 branches setting input_channel, stem_groups, out_ch, activation_cfg). Any other value raises NotImplementedError('mode[<mode>_model] is not implemented!') at construction.
Source
Thrown at ppocr/modeling/backbones/rec_micronet.py:551
input_channel = 6
stem_groups = 3, 2
out_ch = 576
activation_cfg["init_a"] = 1.0, 1.0
activation_cfg["init_b"] = 0.0, 0.0
elif mode == "M2":
input_channel = 8
stem_groups = 4, 2
out_ch = 768
activation_cfg["init_a"] = 1.0, 1.0
activation_cfg["init_b"] = 0.0, 0.0
elif mode == "M3":
input_channel = 12
stem_groups = 4, 3
out_ch = 432
activation_cfg["init_a"] = 1.0, 0.5
activation_cfg["init_b"] = 0.0, 0.5
else:
raise NotImplementedError("mode[" + mode + "_model] is not implemented!")
layers = [StemLayer(3, input_channel, stride=2, groups=stem_groups)]
for idx, val in enumerate(self.cfgs):
s, n, c, ks, c1, c2, g1, g2, c3, g3, g4, y1, y2, y3, r = val
t1 = (c1, c2)
gs1 = (g1, g2)
gs2 = (c3, g3, g4)
activation_cfg["dy"] = [y1, y2, y3]
activation_cfg["ratio"] = r
output_channel = c
layers.append(
DYMicroBlock(
input_channel,
output_channel,
kernel_size=ks,View on GitHub (pinned to 2661c7c0ef)
Solutions
- Set mode to exactly one of 'M0', 'M1', 'M2', 'M3' (uppercase M) in the rec_micronet backbone config
- Remove MobileNetV3-only keys (model_name, scale) from the MicroNet backbone block
- Prefer M2/M3 as in the shipped configs; verify dims also match a supported preset
Example fix
# before Backbone: name: MicroNet mode: m1 # lowercase -> NotImplementedError # after Backbone: name: MicroNet mode: M1
Defensive patterns
Strategy: validation
Validate before calling
assert mode in ('M0', 'M1', 'M2', 'M3'), f'MicroNet mode must be M0-M3, got {mode!r}' Type guard
def is_micronet_mode(m: str) -> bool:
return m in {'M0', 'M1', 'M2', 'M3'} Prevention
- Use exact uppercase 'M0'..'M3'; lowercase fails
- Don't mix MobileNetV3 keys (model_name/scale) into the MicroNet backbone block
- Start from a shipped rec_micronet config and change only what you need
When it happens
Trigger: Backbone config with mode='m0' (lowercase), mode='M4', or a typo like 'MO'; also passing the broader model_name/scale-style keys used by MobileNetV3 configs, which MicroNet does not accept.
Common situations: Copy-pasting a MobileNetV3 backbone block and only changing name: MicroNet, leaving incompatible keys; case-sensitive YAML values; assuming more variants exist than the four implemented.
Related errors
- The mixer must be one of [Global, Local, Conv]
- {} is not supported in MultiLoss yet
- mode[{model_name}_model] is not implemented!
- RecResizeImg.image_shape is required in rec inference.yml
- Unexpected recognition channels: ${String(channels)}
AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14).
Data as JSON: /api/errors/e2015f53a4b7304a.
Report an issue: GitHub.