open-mmlab/mmdetection · warning

If you want to use cost-based ATSSAssigner, please set cls_

Error message

If you want to use cost-based ATSSAssigner,  please set cls_scores, bbox_preds and self.alpha at the same time. 

What it means

Warning from ATSSAssigner.assign: the assigner was built without alpha (classic ATSS mode) yet pred_instances contains 'scores'/'bboxes', which are only consumed by the cost-based (DDOD) variant. The extra prediction data is ignored, so if cost-based assignment was intended the config is wrong.

Source

Thrown at mmdet/models/task_modules/assigners/atss_assigner.py:140

            gt_bboxes_ignore = gt_instances_ignore.bboxes
        else:
            gt_bboxes_ignore = None

        INF = 100000000
        priors = priors[:, :4]
        num_gt, num_priors = gt_bboxes.size(0), priors.size(0)

        message = 'Invalid alpha parameter because cls_scores or ' \
                  'bbox_preds are None. If you want to use the ' \
                  'cost-based ATSSAssigner,  please set cls_scores, ' \
                  'bbox_preds and self.alpha at the same time. '

        # compute iou between all bbox and gt
        if self.alpha is None:
            # ATSSAssigner
            overlaps = self.iou_calculator(priors, gt_bboxes)
            if ('scores' in pred_instances or 'bboxes' in pred_instances):
                warnings.warn(message)

        else:
            # Dynamic cost ATSSAssigner in DDOD
            assert ('scores' in pred_instances
                    and 'bboxes' in pred_instances), message
            cls_scores = pred_instances.scores
            bbox_preds = pred_instances.bboxes

            # compute cls cost for bbox and GT
            cls_cost = torch.sigmoid(cls_scores[:, gt_labels])

            # compute iou between all bbox and gt
            overlaps = self.iou_calculator(bbox_preds, gt_bboxes)

            # make sure that we are in element-wise multiplication
            assert cls_cost.shape == overlaps.shape

            # overlaps is actually a cost matrix

View on GitHub (pinned to cfd5d3a985)

Solutions

  1. Add alpha=1.0 (or desired value) to the ATSSAssigner config to enable the cost-based DDOD variant
  2. If classic ATSS is intended, ensure pred_instances only carries the fields classic ATSS needs so the warning is moot
  3. Verify head passes cls_scores/bbox_preds consistently with the assigner mode

Example fix

# before
assigner=dict(type='ATSSAssigner', topk=9)
# after
assigner=dict(type='ATSSAssigner', topk=9, alpha=1.0)
Defensive patterns

Strategy: validation

Validate before calling

is_cost_based = 'alpha' in assigner_cfg and assigner_cfg['alpha'] is not None
if is_cost_based:
    assert all(k in assigner_cfg for k in ('alpha',)), 'DDOD ATSS requires alpha; head must pass scores+bboxes'

Prevention

When it happens

Trigger: Configuring train_cfg.assigner=dict(type='ATSSAssigner') without alpha while the head passes scores and bboxes in pred_instances (DDOD-style training); typical when switching a head to DDOD but forgetting to update the assigner.

Common situations: Setting up DDOD or cost-aware assignment; alpha defaults to None so silently downgrades to IoU-only ATSS.

Related errors


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