open-mmlab/mmdetection · warning

In rpn_proposal or test_cfg, nms_thr has been moved to a dic

Error message

In rpn_proposal or test_cfg, nms_thr has been moved to a dict named nms as iou_threshold, max_num has been renamed as max_per_img, name of original arguments and the way to specify iou_threshold of NMS will be deprecated.

What it means

Warning from merge_aug_proposals: the test-time RPN proposal config still uses the old flat keys nms_thr / max_num. NMS settings moved into a nested dict nms=dict(iou_threshold=..., type='nms'), and max_num was renamed max_per_img; the old flat arguments will be deprecated.

Source

Thrown at mmdet/models/test_time_augs/merge_augs.py:40

            original image size.

        img_metas (list[dict]): list of image info dict where each dict has:
            'img_shape', 'scale_factor', 'flip', and may also contain
            'filename', 'ori_shape', 'pad_shape', and 'img_norm_cfg'.
            For details on the values of these keys see
            `mmdet/datasets/pipelines/formatting.py:Collect`.

        cfg (dict): rpn test config.

    Returns:
        Tensor: shape (n, 4), proposals corresponding to original image scale.
    """

    cfg = copy.deepcopy(cfg)

    # deprecate arguments warning
    if 'nms' not in cfg or 'max_num' in cfg or 'nms_thr' in cfg:
        warnings.warn(
            'In rpn_proposal or test_cfg, '
            'nms_thr has been moved to a dict named nms as '
            'iou_threshold, max_num has been renamed as max_per_img, '
            'name of original arguments and the way to specify '
            'iou_threshold of NMS will be deprecated.')
    if 'nms' not in cfg:
        cfg.nms = ConfigDict(dict(type='nms', iou_threshold=cfg.nms_thr))
    if 'max_num' in cfg:
        if 'max_per_img' in cfg:
            assert cfg.max_num == cfg.max_per_img, f'You set max_num and ' \
                f'max_per_img at the same time, but get {cfg.max_num} ' \
                f'and {cfg.max_per_img} respectively' \
                f'Please delete max_num which will be deprecated.'
        else:
            cfg.max_per_img = cfg.max_num
    if 'nms_thr' in cfg:
        assert cfg.nms.iou_threshold == cfg.nms_thr, f'You set ' \
            f'iou_threshold in nms and ' \

View on GitHub (pinned to cfd5d3a985)

Solutions

  1. Rewrite rpn_proposal/test_cfg to use nms=dict(type='nms', iou_threshold=0.7) and max_per_img=1000
  2. Remove nms_thr and max_num keys
  3. Validate test_cfg against a current config in mmdet configs/ for your model

Example fix

# before
test_cfg=dict(rpn_proposal=dict(nms_thr=0.7, max_num=1000))
# after
test_cfg=dict(rpn_proposal=dict(nms=dict(type='nms', iou_threshold=0.7), max_per_img=1000))
Defensive patterns

Strategy: validation

Validate before calling

prop = test_cfg.get('rpn_proposal', test_cfg)
assert 'nms' in prop and 'nms_thr' not in prop and 'max_num' not in prop, 'migrate nms_thr/max_num to nms.iou_threshold/max_per_img'

Prevention

When it happens

Trigger: Running multi-scale / flip augmentation testing (aug_test_rpn → merge_aug_proposals) with a test_cfg/rpn_proposal dict that lacks a 'nms' sub-dict or still contains nms_thr / max_num keys; old Faster R-CNN / two-stage configs.

Common situations: Reusing configs from older mmdet releases where rpn_proposal=dict(nms_thr=0.7, max_num=1000) was the schema; version upgrades change the NMS config format.

Related errors


AI-assisted analysis of open-mmlab/mmdetection@cfd5d3a985 (2026-08-27). Data as JSON: /api/errors/477b483654cfa5c6. Report an issue: GitHub.