{"record":{"id":"c22d78e3d5c1249d","repo":"lllyasviel/Fooocus","slug":"network-name-network-name","errorCode":null,"errorMessage":"network_name={network_name}","messagePattern":"network_name=(.+?)","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"extras/facexlib/detection/retinaface.py","lineNumber":68,"sourceCode":"        'epoch': 100,\n        'decay1': 70,\n        'decay2': 90,\n        'image_size': 840,\n        'return_layers': {\n            'layer2': 1,\n            'layer3': 2,\n            'layer4': 3\n        },\n        'in_channel': 256,\n        'out_channel': 256\n    }\n\n    if network_name == 'mobile0.25':\n        return cfg_mnet\n    elif network_name == 'resnet50':\n        return cfg_re50\n    else:\n        raise NotImplementedError(f'network_name={network_name}')\n\n\nclass RetinaFace(nn.Module):\n\n    def __init__(self, network_name='resnet50', half=False, phase='test', device=None):\n        self.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') if device is None else device\n\n        super(RetinaFace, self).__init__()\n        self.half_inference = half\n        cfg = generate_config(network_name)\n        self.backbone = cfg['name']\n\n        self.model_name = f'retinaface_{network_name}'\n        self.cfg = cfg\n        self.phase = phase\n        self.target_size, self.max_size = 1600, 2150\n        self.resize, self.scale, self.scale1 = 1., None, None\n        self.mean_tensor = torch.tensor([[[[104.]], [[117.]], [[123.]]]], device=self.device)","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/lllyasviel/Fooocus/blob/ae05379cc97bc4361ec8b4ec90193dab21be763f/extras/facexlib/detection/retinaface.py#L50-L86","documentation":"Raised by facexlib's generate_config() when building a RetinaFace detection model with a network_name that is neither 'mobile0.25' nor 'resnet50'. The factory only ships two backbone configs, so any other string falls through to NotImplementedError. It fires inside RetinaFace.__init__ (and init_detection_model), i.e. at model construction time before any inference.","triggerScenarios":"Calling RetinaFace(network_name='resnet18') / init_detection_model(det_model='resnet18', ...) or any typo like 'MobileNet0.25', 'mobile0_25', 'resnet101'. Only exact strings 'mobile0.25' and 'resnet50' are accepted.","commonSituations":"Copying a model name from another repo (e.g. insightface's det names or IR-SE variants), typo in YAML/CLI config, or trying to plug a custom backbone into facexlib without extending generate_config.","solutions":["Use exactly 'mobile0.25' (lightweight) or 'resnet50' (accurate) as network_name.","Check for typos/case differences in the config value passed to init_detection_model or RetinaFace.","If you truly need another backbone, add a cfg dict for it in extras/facexlib/detection/retinaface.py and return it from generate_config(), plus a matching pretrained URL.","Downstream (e.g. GFPGAN/CodeFormer restore) usually requires 'retinaface_resnet50'; pass that name."],"exampleFix":"// before\nmodel = init_detection_model('resnet18', device=device)\n\n// after\nmodel = init_detection_model('resnet50', device=device)  # or 'mobile0.25'","handlingStrategy":"validation","validationCode":"VALID_NETWORKS = {'mobile0.25', 'resnet50'}\nif network_name not in VALID_NETWORKS:\n    raise ValueError(f'network_name must be one of {sorted(VALID_NETWORKS)}, got {network_name!r}')","typeGuard":"def is_valid_retinaface_network(name: str) -> bool:\n    return name in {'mobile0.25', 'resnet50'}","tryCatchPattern":"try:\n    model = init_detection_model(network_name, device=device)\nexcept NotImplementedError as e:\n    logger.error('Unsupported RetinaFace backbone: %s (use mobile0.25 or resnet50)', network_name)\n    raise","preventionTips":["Whitelist the two valid names at the config/UI boundary before constructing the model.","Add unit tests asserting exact accepted strings so renames surface early.","Keep model-name constants in one place instead of scattering string literals."],"tags":["facexlib","retinaface","model-config","not-implemented"],"backgroundTag":null,"analyzedSha":"ae05379cc97bc4361ec8b4ec90193dab21be763f","analyzedAt":"2026-08-15T04:23:59.533Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}