open-mmlab/mmdetection · warning
DeprecationWarning: pos_bboxes is deprecated, please use "po
Error message
DeprecationWarning: pos_bboxes is deprecated, please use "pos_priors" instead
What it means
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.
Source
Thrown at mmdet/models/task_modules/samplers/sampling_result.py:132
if len(gt_bboxes.shape) < 2:
gt_bboxes = gt_bboxes.view(-1, box_dim)
self.pos_gt_bboxes = gt_bboxes[self.pos_assigned_gt_inds.long()]
@property
def priors(self):
"""torch.Tensor: concatenated positive and negative priors"""
return cat_boxes([self.pos_priors, self.neg_priors])
@property
def bboxes(self):
"""torch.Tensor: concatenated positive and negative boxes"""
warnings.warn('DeprecationWarning: bboxes is deprecated, '
'please use "priors" instead')
return self.priors
@property
def pos_bboxes(self):
warnings.warn('DeprecationWarning: pos_bboxes is deprecated, '
'please use "pos_priors" instead')
return self.pos_priors
@property
def neg_bboxes(self):
warnings.warn('DeprecationWarning: neg_bboxes is deprecated, '
'please use "neg_priors" instead')
return self.neg_priors
def to(self, device):
"""Change the device of the data inplace.
Example:
>>> self = SamplingResult.random()
>>> print(f'self = {self.to(None)}')
>>> # xdoctest: +REQUIRES(--gpu)
>>> print(f'self = {self.to(0)}')
"""View on GitHub (pinned to cfd5d3a985)
Solutions
- Use sampling_result.pos_priors
- Update all three attributes (bboxes/pos_bboxes/neg_bboxes) to the priors naming
- Update custom code consuming SamplingResult
Example fix
# before pos_rois = sampling_result.pos_bboxes # after pos_rois = sampling_result.pos_priors
Defensive patterns
Strategy: type-guard
Validate before calling
assert hasattr(result, 'pos_priors')
Type guard
def get_pos_priors(result):
return result.pos_priors if hasattr(result, 'pos_priors') else result.pos_bboxes Prevention
- Use pos_priors in custom sampler code
- Centralize SamplingResult field access behind helpers
When it happens
Trigger: Accessing sampling_result.pos_bboxes in custom sampler logic, tests, or visualization code that inspects positive samples.
Common situations: Custom RoI align heads sampling positives; older tutorials referencing pos_bboxes.
Related errors
- DeprecationWarning: bboxes is deprecated, please use "priors
- DeprecationWarning: neg_bboxes is deprecated, please use "ne
- ``grid_anchors`` would be deprecated soon. Please use ``grid
- ``single_level_grid_anchors`` would be deprecated soon. Plea
- pretrained must be a str or None
AI-assisted analysis of open-mmlab/mmdetection@cfd5d3a985 (2026-08-27).
Data as JSON: /api/errors/8c93d08a12cdd1b8.
Report an issue: GitHub.