From ba727cd48f7b9645d52e27d58ad75f2d9a8b4ff8 Mon Sep 17 00:00:00 2001 From: Christian Behrens <9531979+chbehrens@users.noreply.github.com> Date: Tue, 9 Jan 2024 11:41:51 +0100 Subject: [PATCH 1/3] only create post_center_range Tensor once --- .../models/task_modules/coders/centerpoint_bbox_coders.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mmdet3d/models/task_modules/coders/centerpoint_bbox_coders.py b/mmdet3d/models/task_modules/coders/centerpoint_bbox_coders.py index f3359d6bc1..03c015540b 100644 --- a/mmdet3d/models/task_modules/coders/centerpoint_bbox_coders.py +++ b/mmdet3d/models/task_modules/coders/centerpoint_bbox_coders.py @@ -36,7 +36,7 @@ def __init__(self, self.pc_range = pc_range self.out_size_factor = out_size_factor self.voxel_size = voxel_size - self.post_center_range = post_center_range + self.post_center_range = Tensor(post_center_range) self.max_num = max_num self.score_threshold = score_threshold self.code_size = code_size @@ -204,8 +204,8 @@ def decode(self, thresh_mask = final_scores > self.score_threshold if self.post_center_range is not None: - self.post_center_range = torch.tensor( - self.post_center_range, device=heat.device) + self.post_center_range = self.post_center_range.to( + device=heat.device) mask = (final_box_preds[..., :3] >= self.post_center_range[:3]).all(2) mask &= (final_box_preds[..., :3] <= From 354fff562f7d001e94358aed9d1ad744865af4f1 Mon Sep 17 00:00:00 2001 From: Christian Behrens <9531979+chbehrens@users.noreply.github.com> Date: Wed, 10 Jan 2024 08:58:37 +0100 Subject: [PATCH 2/3] fix for post_center_range default value --- mmdet3d/models/task_modules/coders/centerpoint_bbox_coders.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mmdet3d/models/task_modules/coders/centerpoint_bbox_coders.py b/mmdet3d/models/task_modules/coders/centerpoint_bbox_coders.py index 03c015540b..073a6a7ada 100644 --- a/mmdet3d/models/task_modules/coders/centerpoint_bbox_coders.py +++ b/mmdet3d/models/task_modules/coders/centerpoint_bbox_coders.py @@ -36,7 +36,8 @@ def __init__(self, self.pc_range = pc_range self.out_size_factor = out_size_factor self.voxel_size = voxel_size - self.post_center_range = Tensor(post_center_range) + self.post_center_range = Tensor( + post_center_range) if post_center_range is not None else None self.max_num = max_num self.score_threshold = score_threshold self.code_size = code_size From eb5b682d1fe95ea666678be76a6460a049117137 Mon Sep 17 00:00:00 2001 From: Christian Behrens <9531979+chbehrens@users.noreply.github.com> Date: Mon, 15 Jan 2024 14:44:18 +0100 Subject: [PATCH 3/3] fix decode type annotation and dimensions in docstring --- .../models/task_modules/coders/centerpoint_bbox_coders.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mmdet3d/models/task_modules/coders/centerpoint_bbox_coders.py b/mmdet3d/models/task_modules/coders/centerpoint_bbox_coders.py index 073a6a7ada..9c06bfddda 100644 --- a/mmdet3d/models/task_modules/coders/centerpoint_bbox_coders.py +++ b/mmdet3d/models/task_modules/coders/centerpoint_bbox_coders.py @@ -127,7 +127,7 @@ def decode(self, rot_cosine: Tensor, hei: Tensor, dim: Tensor, - vel: Tensor, + vel: Optional[Tensor], reg: Optional[Tensor] = None, task_id: int = -1) -> List[Dict[str, Tensor]]: """Decode bboxes. @@ -141,8 +141,8 @@ def decode(self, hei (torch.Tensor): Height of the boxes with the shape of [B, 1, W, H]. dim (torch.Tensor): Dim of the boxes with the shape of - [B, 1, W, H]. - vel (torch.Tensor): Velocity with the shape of [B, 1, W, H]. + [B, 3, W, H]. + vel (torch.Tensor): Velocity with the shape of [B, 2, W, H]. reg (torch.Tensor, optional): Regression value of the boxes in 2D with the shape of [B, 2, W, H]. Default: None. task_id (int, optional): Index of task. Default: -1.