| 24 | return normalized_bboxes |
| 25 | |
| 26 | def denormalize_bbox(normalized_bboxes, pc_range): |
| 27 | # rotation |
| 28 | rot_sine = normalized_bboxes[..., 6:7] |
| 29 | |
| 30 | rot_cosine = normalized_bboxes[..., 7:8] |
| 31 | rot = torch.atan2(rot_sine, rot_cosine) |
| 32 | |
| 33 | # center in the bev |
| 34 | cx = normalized_bboxes[..., 0:1] |
| 35 | cy = normalized_bboxes[..., 1:2] |
| 36 | cz = normalized_bboxes[..., 4:5] |
| 37 | |
| 38 | # size |
| 39 | w = normalized_bboxes[..., 2:3] |
| 40 | l = normalized_bboxes[..., 3:4] |
| 41 | h = normalized_bboxes[..., 5:6] |
| 42 | |
| 43 | w = w.exp() |
| 44 | l = l.exp() |
| 45 | h = h.exp() |
| 46 | if normalized_bboxes.size(-1) > 8: |
| 47 | # velocity |
| 48 | vx = normalized_bboxes[:, 8:9] |
| 49 | vy = normalized_bboxes[:, 9:10] |
| 50 | denormalized_bboxes = torch.cat([cx, cy, cz, w, l, h, rot, vx, vy], dim=-1) |
| 51 | else: |
| 52 | denormalized_bboxes = torch.cat([cx, cy, cz, w, l, h, rot], dim=-1) |
| 53 | return denormalized_bboxes |