{"record":{"id":"89d9cb4ed75df181","repo":"open-mmlab/mmdetection","slug":"deprecationwarning-onnx-delta2bbox-is-deprecated","errorCode":null,"errorMessage":"DeprecationWarning: onnx_delta2bbox is deprecated in the case of batch decoding and non-ONNX, please use “delta2bbox” instead. In order to improve the decoding speed, the batch function will no longer be supported. ","messagePattern":"DeprecationWarning: onnx_delta2bbox is deprecated in the case of batch decoding and non-ONNX, please use “delta2bbox” instead\\. In order to improve the decoding speed, the batch function will no longer be supported\\. ","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"mmdet/models/task_modules/coders/delta_xywh_bbox_coder.py","lineNumber":112,"sourceCode":"                width and height.\n\n        Returns:\n            Union[torch.Tensor, :obj:`BaseBoxes`]: Decoded boxes.\n        \"\"\"\n        bboxes = get_box_tensor(bboxes)\n        assert pred_bboxes.size(0) == bboxes.size(0)\n        if pred_bboxes.ndim == 3:\n            assert pred_bboxes.size(1) == bboxes.size(1)\n\n        if pred_bboxes.ndim == 2 and not torch.onnx.is_in_onnx_export():\n            # single image decode\n            decoded_bboxes = delta2bbox(bboxes, pred_bboxes, self.means,\n                                        self.stds, max_shape, wh_ratio_clip,\n                                        self.clip_border, self.add_ctr_clamp,\n                                        self.ctr_clamp)\n        else:\n            if pred_bboxes.ndim == 3 and not torch.onnx.is_in_onnx_export():\n                warnings.warn(\n                    'DeprecationWarning: onnx_delta2bbox is deprecated '\n                    'in the case of batch decoding and non-ONNX, '\n                    'please use “delta2bbox” instead. In order to improve '\n                    'the decoding speed, the batch function will no '\n                    'longer be supported. ')\n            decoded_bboxes = onnx_delta2bbox(bboxes, pred_bboxes, self.means,\n                                             self.stds, max_shape,\n                                             wh_ratio_clip, self.clip_border,\n                                             self.add_ctr_clamp,\n                                             self.ctr_clamp)\n\n        if self.use_box_type:\n            assert decoded_bboxes.size(-1) == 4, \\\n                ('Cannot warp decoded boxes with box type when decoded boxes'\n                 'have shape of (N, num_classes * 4)')\n            decoded_bboxes = HorizontalBoxes(decoded_bboxes)\n        return decoded_bboxes\n","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/task_modules/coders/delta_xywh_bbox_coder.py#L94-L130","documentation":"Deprecation warning from DeltaXYWHBBoxCoder.decode: the else-branch uses the ONNX export helper onnx_delta2bbox even outside ONNX export when pred_bboxes is a 3-D (batched) tensor. Batched decoding via this path is deprecated for speed; use the vectorized delta2bbox instead, as batch support in onnx_delta2bbox will be dropped.","triggerScenarios":"Calling coder.decode(...) with pred_bboxes.ndim == 3 (batched deltas) while not inside torch.onnx.export; e.g. test-time batch prediction or aug-test code feeding batched proposals through a DeltaXYWHBBoxCoder on the non-ONNX path.","commonSituations":"Batch inference / multi-image test loaders hitting a decode path designed for ONNX tracing; upgrading mmdet versions where batch decoding via onnx_delta2bbox is being removed.","solutions":["Decode per-sample (loop over batch) or reshape so pred_bboxes is 2-D before decode","Ensure code uses delta2bbox path (the branch above) rather than falling into the ONNX helper","Update mmdet — newer implementations handle batched decoding natively"],"exampleFix":"# before\ndecoded = coder.decode(anchors, batched_pred_bboxes)  # ndim==3\n# after\ndecoded = torch.cat([coder.decode(anchors[i:i+1].squeeze(0), batched_pred_bboxes[i]) for i in range(batched_pred_bboxes.shape[0])])","handlingStrategy":"validation","validationCode":"assert pred_bboxes.ndim == 2 or torch.onnx.is_in_onnx_export(), 'decode batched deltas per-sample or use delta2bbox path'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep decode inputs 2-D outside ONNX export","Batch: loop or vectorize with delta2bbox rather than the ONNX helper"],"tags":["mmdet","deprecation","bbox-coder","onnx","batch-decode"],"backgroundTag":"deprecated-batched-code-path","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}