{"record":{"id":"e794c1451ede4b40","repo":"open-mmlab/mmdetection","slug":"if-you-want-to-use-cost-based-atssassigner-pleas","errorCode":null,"errorMessage":"If you want to use cost-based ATSSAssigner,  please set cls_scores, bbox_preds and self.alpha at the same time. ","messagePattern":"If you want to use cost-based ATSSAssigner,  please set cls_scores, bbox_preds and self\\.alpha at the same time\\. ","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"mmdet/models/task_modules/assigners/atss_assigner.py","lineNumber":140,"sourceCode":"            gt_bboxes_ignore = gt_instances_ignore.bboxes\n        else:\n            gt_bboxes_ignore = None\n\n        INF = 100000000\n        priors = priors[:, :4]\n        num_gt, num_priors = gt_bboxes.size(0), priors.size(0)\n\n        message = 'Invalid alpha parameter because cls_scores or ' \\\n                  'bbox_preds are None. If you want to use the ' \\\n                  'cost-based ATSSAssigner,  please set cls_scores, ' \\\n                  'bbox_preds and self.alpha at the same time. '\n\n        # compute iou between all bbox and gt\n        if self.alpha is None:\n            # ATSSAssigner\n            overlaps = self.iou_calculator(priors, gt_bboxes)\n            if ('scores' in pred_instances or 'bboxes' in pred_instances):\n                warnings.warn(message)\n\n        else:\n            # Dynamic cost ATSSAssigner in DDOD\n            assert ('scores' in pred_instances\n                    and 'bboxes' in pred_instances), message\n            cls_scores = pred_instances.scores\n            bbox_preds = pred_instances.bboxes\n\n            # compute cls cost for bbox and GT\n            cls_cost = torch.sigmoid(cls_scores[:, gt_labels])\n\n            # compute iou between all bbox and gt\n            overlaps = self.iou_calculator(bbox_preds, gt_bboxes)\n\n            # make sure that we are in element-wise multiplication\n            assert cls_cost.shape == overlaps.shape\n\n            # overlaps is actually a cost matrix","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/task_modules/assigners/atss_assigner.py#L122-L158","documentation":"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.","triggerScenarios":"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.","commonSituations":"Setting up DDOD or cost-aware assignment; alpha defaults to None so silently downgrades to IoU-only ATSS.","solutions":["Add alpha=1.0 (or desired value) to the ATSSAssigner config to enable the cost-based DDOD variant","If classic ATSS is intended, ensure pred_instances only carries the fields classic ATSS needs so the warning is moot","Verify head passes cls_scores/bbox_preds consistently with the assigner mode"],"exampleFix":"# before\nassigner=dict(type='ATSSAssigner', topk=9)\n# after\nassigner=dict(type='ATSSAssigner', topk=9, alpha=1.0)","handlingStrategy":"validation","validationCode":"is_cost_based = 'alpha' in assigner_cfg and assigner_cfg['alpha'] is not None\nif is_cost_based:\n    assert all(k in assigner_cfg for k in ('alpha',)), 'DDOD ATSS requires alpha; head must pass scores+bboxes'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set assigner alpha explicitly when doing cost-based (DDOD) assignment","Keep assigner config in sync with the detection head's training path"],"tags":["mmdet","atss","assigner","ddod"],"backgroundTag":"incomplete-config-mode-mismatch","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}