Skip to content

Commit

Permalink
Update transforms.bbox3droi
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
ashutoshsingh0223 authored Jan 2, 2025
1 parent fe25f7a commit a3d1b16
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mmdet3d/structures/ops/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a3d1b16

Please sign in to comment.