Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Centerpoint bbox coders: Fix torch warning #2873

Open
wants to merge 3 commits into
base: dev-1.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions mmdet3d/models/task_modules/coders/centerpoint_bbox_coders.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 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
Expand Down Expand Up @@ -126,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.
Expand All @@ -140,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.
Expand Down Expand Up @@ -204,8 +205,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] <=
Expand Down
Loading