{"record":{"id":"f2843b185c0c78ca","repo":"open-mmlab/mmdetection","slug":"randomcentercroppad-only-support-two-testing-pad-m","errorCode":null,"errorMessage":"RandomCenterCropPad only support two testing pad mode:logical-or and size_divisor.","messagePattern":"RandomCenterCropPad only support two testing pad mode:logical-or and size_divisor\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"mmdet/datasets/transforms/transforms.py","lineNumber":2126,"sourceCode":"\n        Args:\n            results (dict): Image infomations in the augment pipeline.\n\n        Returns:\n            results (dict): The updated dict.\n        \"\"\"\n        img = results['img']\n        h, w, c = img.shape\n        if self.test_pad_mode[0] in ['logical_or']:\n            # self.test_pad_add_pix is only used for centernet\n            target_h = (h | self.test_pad_mode[1]) + self.test_pad_add_pix\n            target_w = (w | self.test_pad_mode[1]) + self.test_pad_add_pix\n        elif self.test_pad_mode[0] in ['size_divisor']:\n            divisor = self.test_pad_mode[1]\n            target_h = int(np.ceil(h / divisor)) * divisor\n            target_w = int(np.ceil(w / divisor)) * divisor\n        else:\n            raise NotImplementedError(\n                'RandomCenterCropPad only support two testing pad mode:'\n                'logical-or and size_divisor.')\n\n        cropped_img, border, _ = self._crop_image_and_paste(\n            img, [h // 2, w // 2], [target_h, target_w])\n        results['img'] = cropped_img\n        results['img_shape'] = cropped_img.shape[:2]\n        results['border'] = border\n        return results\n\n    @autocast_box_type()\n    def transform(self, results: dict) -> dict:\n        img = results['img']\n        assert img.dtype == np.float32, (\n            'RandomCenterCropPad needs the input image of dtype np.float32,'\n            ' please set \"to_float32=True\" in \"LoadImageFromFile\" pipeline')\n        h, w, c = img.shape\n        assert c == len(self.mean)","sourceCodeStart":2108,"sourceCodeEnd":2144,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/datasets/transforms/transforms.py#L2108-L2144","documentation":"RandomCenterCropPad's test-time padding accepts only two modes: 'logical' (target = w | pad_value, e.g. 32/64/127) or 'size_divisor'. Any other first element of test_pad_mode raises NotImplementedError in _test_aug.","triggerScenarios":"Configuring dict(type='RandomCenterCropPad', test_pad_mode=['square', 32]) or a typo like 'logical_or' instead of 'logical', or passing a single value instead of a [mode, value] list.","commonSituations":"Customizing YOLOX test pipelines with a wrong pad mode name or malformed test_pad_mode tuple.","solutions":["Use test_pad_mode=['logical', 32] (value must be a bitmask like 32/64/127)","Or use test_pad_mode=['size_divisor', 32]","Check exact spelling from the official YOLOX config"],"exampleFix":"# before\ntest_pad_mode=dict(type='logical', size=32)  # wrong structure\n# after\ntest_pad_mode=['size_divisor', 32]","handlingStrategy":"validation","validationCode":"assert self_cfg['test_pad_mode'][0] in ('logical', 'size_divisor'), 'unsupported pad mode'","typeGuard":"def valid_pad_mode(m):\n    return isinstance(m, (list, tuple)) and len(m) == 2 and m[0] in ('logical', 'size_divisor')","tryCatchPattern":null,"preventionTips":["Copy pad mode verbatim from official YOLOX configs","Validate test_pad_mode shape at config load time"],"tags":["mmdet","yolox","pad-mode","config-validation"],"backgroundTag":"invalid-config-value","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}