{"record":{"id":"8c93d08a12cdd1b8","repo":"open-mmlab/mmdetection","slug":"deprecationwarning-pos-bboxes-is-deprecated-plea","errorCode":null,"errorMessage":"DeprecationWarning: pos_bboxes is deprecated, please use \"pos_priors\" instead","messagePattern":"DeprecationWarning: pos_bboxes is deprecated, please use \"pos_priors\" instead","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"mmdet/models/task_modules/samplers/sampling_result.py","lineNumber":132,"sourceCode":"            if len(gt_bboxes.shape) < 2:\n                gt_bboxes = gt_bboxes.view(-1, box_dim)\n            self.pos_gt_bboxes = gt_bboxes[self.pos_assigned_gt_inds.long()]\n\n    @property\n    def priors(self):\n        \"\"\"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        \"\"\"","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/task_modules/samplers/sampling_result.py#L114-L150","documentation":"Deprecation warning from SamplingResult.pos_bboxes: renamed to pos_priors, since these are the positive prior anchors matched to GT boxes. The property forwards to self.pos_priors and will be removed.","triggerScenarios":"Accessing sampling_result.pos_bboxes in custom sampler logic, tests, or visualization code that inspects positive samples.","commonSituations":"Custom RoI align heads sampling positives; older tutorials referencing pos_bboxes.","solutions":["Use sampling_result.pos_priors","Update all three attributes (bboxes/pos_bboxes/neg_bboxes) to the priors naming","Update custom code consuming SamplingResult"],"exampleFix":"# before\npos_rois = sampling_result.pos_bboxes\n# after\npos_rois = sampling_result.pos_priors","handlingStrategy":"type-guard","validationCode":"assert hasattr(result, 'pos_priors')","typeGuard":"def get_pos_priors(result):\n    return result.pos_priors if hasattr(result, 'pos_priors') else result.pos_bboxes","tryCatchPattern":null,"preventionTips":["Use pos_priors in custom sampler code","Centralize SamplingResult field access behind helpers"],"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"}