{"record":{"id":"346cff9e166c1452","repo":"open-mmlab/mmdetection","slug":"deprecationwarning-neg-bboxes-is-deprecated-plea","errorCode":null,"errorMessage":"DeprecationWarning: neg_bboxes is deprecated, please use \"neg_priors\" instead","messagePattern":"DeprecationWarning: neg_bboxes is deprecated, please use \"neg_priors\" instead","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"mmdet/models/task_modules/samplers/sampling_result.py","lineNumber":138,"sourceCode":"        \"\"\"torch.Tensor: concatenated positive and negative priors\"\"\"\n        return cat_boxes([self.pos_priors, self.neg_priors])\n\n    @property\n    def bboxes(self):\n        \"\"\"torch.Tensor: concatenated positive and negative boxes\"\"\"\n        warnings.warn('DeprecationWarning: bboxes is deprecated, '\n                      'please use \"priors\" instead')\n        return self.priors\n\n    @property\n    def pos_bboxes(self):\n        warnings.warn('DeprecationWarning: pos_bboxes is deprecated, '\n                      'please use \"pos_priors\" instead')\n        return self.pos_priors\n\n    @property\n    def neg_bboxes(self):\n        warnings.warn('DeprecationWarning: neg_bboxes is deprecated, '\n                      'please use \"neg_priors\" instead')\n        return self.neg_priors\n\n    def to(self, device):\n        \"\"\"Change the device of the data inplace.\n\n        Example:\n            >>> self = SamplingResult.random()\n            >>> print(f'self = {self.to(None)}')\n            >>> # xdoctest: +REQUIRES(--gpu)\n            >>> print(f'self = {self.to(0)}')\n        \"\"\"\n        _dict = self.__dict__\n        for key, value in _dict.items():\n            if isinstance(value, (torch.Tensor, BaseBoxes)):\n                _dict[key] = value.to(device)\n        return self\n","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/task_modules/samplers/sampling_result.py#L120-L156","documentation":"Deprecation warning from SamplingResult.neg_bboxes: renamed to neg_priors (negative prior anchors). The property forwards to self.neg_priors and will be removed in a future release.","triggerScenarios":"Accessing sampling_result.neg_bboxes in custom negative-sample handling, OHEM-style logic, or tests.","commonSituations":"Custom samplers / hard-negative mining code using the old attribute name after the priors rename.","solutions":["Use sampling_result.neg_priors","Migrate bboxes and pos_bboxes accesses at the same time","Run tests to catch remaining legacy attribute accesses"],"exampleFix":"# before\nneg_rois = sampling_result.neg_bboxes\n# after\nneg_rois = sampling_result.neg_priors","handlingStrategy":"type-guard","validationCode":"assert hasattr(result, 'neg_priors')","typeGuard":"def get_neg_priors(result):\n    return result.neg_priors if hasattr(result, 'neg_priors') else result.neg_bboxes","tryCatchPattern":null,"preventionTips":["Use neg_priors in hard-negative mining code","Migrate all three renamed attributes at once"],"tags":["mmdet","deprecation","sampling-result","priors"],"backgroundTag":"deprecated-api-renamed","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}