open-mmlab/mmdetection · warning
nms_cfg in test_cfg will be deprecated. Please rename it as
Error message
nms_cfg in test_cfg will be deprecated. Please rename it as nms
What it means
CornerHead._bboxes_nms warns (note: via a buggy `warning.warn` call — it should be `warnings.warn`, so this line itself can raise NameError in some versions) when test_cfg still uses the old key `nms_cfg` instead of `nms`, then aliases cfg.nms = cfg.nms_cfg. The config key was renamed in mmdet 3.x.
Source
Thrown at mmdet/models/dense_heads/corner_head.py:834
keepinds = (det_bboxes[:, -1] > -0.1)
det_bboxes = det_bboxes[keepinds]
det_labels = clses[keepinds]
if with_nms:
det_bboxes, det_labels = self._bboxes_nms(det_bboxes, det_labels,
self.test_cfg)
results = InstanceData()
results.bboxes = det_bboxes[..., :4]
results.scores = det_bboxes[..., 4]
results.labels = det_labels
return results
def _bboxes_nms(self, bboxes: Tensor, labels: Tensor,
cfg: ConfigDict) -> Tuple[Tensor, Tensor]:
"""bboxes nms."""
if 'nms_cfg' in cfg:
warning.warn('nms_cfg in test_cfg will be deprecated. '
'Please rename it as nms')
if 'nms' not in cfg:
cfg.nms = cfg.nms_cfg
if labels.numel() > 0:
max_num = cfg.max_per_img
bboxes, keep = batched_nms(bboxes[:, :4], bboxes[:,
-1].contiguous(),
labels, cfg.nms)
if max_num > 0:
bboxes = bboxes[:max_num]
labels = labels[keep][:max_num]
return bboxes, labels
def _decode_heatmap(self,
tl_heat: Tensor,
br_heat: Tensor,View on GitHub (pinned to cfd5d3a985)
Solutions
- Rename `nms_cfg` to `nms` in the model's test_cfg in your config
- If you hit a NameError on `warning.warn`, upgrade mmdet — the typo was fixed upstream
Example fix
# before test_cfg=dict(nms_cfg=dict(type='nms', iou_threshold=0.5), max_per_img=100) # after test_cfg=dict(nms=dict(type='nms', iou_threshold=0.5), max_per_img=100)
Defensive patterns
Strategy: validation
Validate before calling
test_cfg = cfg['model'].get('test_cfg', {})
if 'nms_cfg' in test_cfg:
test_cfg['nms'] = test_cfg.pop('nms_cfg') # migrate before building model Prevention
- Run mmdet's config migration tools when upgrading 2.x -> 3.x
- Never keep nms_cfg alongside nms in test_cfg
When it happens
Trigger: Running CornerNet inference with a test_cfg containing `nms_cfg=...` instead of `nms=...` (old 2.x config).
Common situations: Reusing mmdet 2.x CornerNet configs with mmdet 3.x; converting configs manually and missing the nms key rename.
Related errors
- {kernel} kernel is not supported in matrix nms!
- The `file_client_args` is deprecated, please use `backend_ar
- The annotation file of Open Images Challenge should be a txt
- Invalid text mode "{self.text_mode}".
- No sample in split "{self.split}".
AI-assisted analysis of open-mmlab/mmdetection@cfd5d3a985 (2026-08-27).
Data as JSON: /api/errors/9962fdbc32452823.
Report an issue: GitHub.