{"record":{"id":"6afd00c3ac24efbf","repo":"open-mmlab/mmdetection","slug":"invalid-upsample-method-accepted-methods-are","errorCode":null,"errorMessage":"Invalid upsample method {}, accepted methods are \"deconv\", \"nearest\", \"bilinear\", \"carafe\"","messagePattern":"Invalid upsample method (.+?), accepted methods are \"deconv\", \"nearest\", \"bilinear\", \"carafe\"","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mmdet/models/roi_heads/mask_heads/fcn_mask_head.py","lineNumber":54,"sourceCode":"                 conv_out_channels: int = 256,\n                 num_classes: int = 80,\n                 class_agnostic: int = False,\n                 upsample_cfg: ConfigType = dict(\n                     type='deconv', scale_factor=2),\n                 conv_cfg: OptConfigType = None,\n                 norm_cfg: OptConfigType = None,\n                 predictor_cfg: ConfigType = dict(type='Conv'),\n                 loss_mask: ConfigType = dict(\n                     type='CrossEntropyLoss', use_mask=True, loss_weight=1.0),\n                 init_cfg: OptMultiConfig = None) -> None:\n        assert init_cfg is None, 'To prevent abnormal initialization ' \\\n                                 'behavior, init_cfg is not allowed to be set'\n        super().__init__(init_cfg=init_cfg)\n        self.upsample_cfg = upsample_cfg.copy()\n        if self.upsample_cfg['type'] not in [\n                None, 'deconv', 'nearest', 'bilinear', 'carafe'\n        ]:\n            raise ValueError(\n                f'Invalid upsample method {self.upsample_cfg[\"type\"]}, '\n                'accepted methods are \"deconv\", \"nearest\", \"bilinear\", '\n                '\"carafe\"')\n        self.num_convs = num_convs\n        # WARN: roi_feat_size is reserved and not used\n        self.roi_feat_size = _pair(roi_feat_size)\n        self.in_channels = in_channels\n        self.conv_kernel_size = conv_kernel_size\n        self.conv_out_channels = conv_out_channels\n        self.upsample_method = self.upsample_cfg.get('type')\n        self.scale_factor = self.upsample_cfg.pop('scale_factor', None)\n        self.num_classes = num_classes\n        self.class_agnostic = class_agnostic\n        self.conv_cfg = conv_cfg\n        self.norm_cfg = norm_cfg\n        self.predictor_cfg = predictor_cfg\n        self.loss_mask = MODELS.build(loss_mask)\n","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/roi_heads/mask_heads/fcn_mask_head.py#L36-L72","documentation":"FCNMaskHead validates upsample_cfg['type'] at construction: only None, 'deconv', 'nearest', 'bilinear', 'carafe' are accepted. Any other upsample type string raises ValueError immediately.","triggerScenarios":"mask_head=dict(type='FCNMaskHead', upsample_cfg=dict(type='bubic'/'deconvolution'/'pixelshuffle', ...)) — a typo'd or unsupported upsampling method name.","commonSituations":"Hand-writing mask head configs for Mask R-CNN; using Detectron2/mmseg-style upsample names; setting upsample_cfg type that mmdet never supported.","solutions":["Fix the typo: use 'deconv', 'nearest', 'bilinear', or 'carafe'","For transposed convolution include kernel_size etc.: dict(type='deconv', kernel_size=4, stride=2)","Set upsample_cfg=None (or omit) if no upsampling is wanted"],"exampleFix":"# before\nupsample_cfg=dict(type='bilinear2', scale_factor=2)\n# after\nupsample_cfg=dict(type='bilinear', scale_factor=2.0)","handlingStrategy":"validation","validationCode":"VALID_UP = {None, 'deconv', 'nearest', 'bilinear', 'carafe'}\nassert upsample_cfg is None or upsample_cfg['type'] in VALID_UP","typeGuard":"def valid_upsample_cfg(c): return c is None or c.get('type') in {None,'deconv','nearest','bilinear','carafe'}","tryCatchPattern":null,"preventionTips":["Copy upsample_cfg blocks from official mask-rcnn configs","Prefer simple dict(type='bilinear') or omit entirely"],"tags":["mmdetection","mask-head","config"],"backgroundTag":"invalid-config-value","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}