From a3d1b162867b0b3286bef2559121be2c5c060ed5 Mon Sep 17 00:00:00 2001 From: Ashutosh Singh <40604544+ashutoshsingh0223@users.noreply.github.com> Date: Thu, 2 Jan 2025 14:52:21 +0100 Subject: [PATCH] Update transforms.bbox3droi This method returns a tensor. There was a condition that led to returns of tensors with 7 or 8 size on dim 1 depending on the fulfillment of the condition. The change fixes the shape to 8 without any other changes. This is necessary because the downstream modules that use this output expect a size of 8 on dim 1 not 7. See `Single3DRoIPointExtractor.forward` --- mmdet3d/structures/ops/transforms.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mmdet3d/structures/ops/transforms.py b/mmdet3d/structures/ops/transforms.py index 8e9f7006ac..1a698d9f4c 100644 --- a/mmdet3d/structures/ops/transforms.py +++ b/mmdet3d/structures/ops/transforms.py @@ -37,11 +37,12 @@ def bbox3d2roi(bbox_list): """ rois_list = [] for img_id, bboxes in enumerate(bbox_list): + img_inds = bboxes.new_full((bboxes.size(0), 1), img_id) if bboxes.size(0) > 0: - img_inds = bboxes.new_full((bboxes.size(0), 1), img_id) rois = torch.cat([img_inds, bboxes], dim=-1) else: rois = torch.zeros_like(bboxes) + rois = torch.cat([img_inds, rois], dim=-1) rois_list.append(rois) rois = torch.cat(rois_list, 0) return rois