Skip to content

Commit 275e8c9

Browse files
committed
modified bbox3d
1 parent 1410aca commit 275e8c9

File tree

7 files changed

+67
-17
lines changed

7 files changed

+67
-17
lines changed

.vscode/launch.json

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Debug Training",
6+
"type": "python",
7+
"request": "launch",
8+
"program": "${workspaceFolder}/tools/train.py",
9+
"args": [
10+
"./projects/configs/stage1_track_map/base_track_map.py",
11+
"--gpus",
12+
"1",
13+
"--deterministic",
14+
"--work-dir",
15+
"${workspaceFolder}/work_dirs/train1"
16+
],
17+
"env": {
18+
"MASTER_ADDR": "127.0.0.1",
19+
"MASTER_PORT": "28596",
20+
"PYTHONPATH": "${workspaceFolder}/..:${env:PYTHONPATH}"
21+
},
22+
"console": "integratedTerminal"
23+
}
24+
]
25+
}
26+
27+
28+
29+
// {
30+
// "version": "0.2.0",
31+
// "configurations": [
32+
// {
33+
// "name": "Debug Evaluating",
34+
// "type": "python",
35+
// "request": "launch",
36+
// "program": "${workspaceFolder}/tools/test.py",
37+
// "args": [
38+
// "./projects/configs/stage1_track_map/base_track_map.py",
39+
// "./ckpts/uniad_base_track_map.pth",
40+
// "--show-dir",
41+
// "${workspaceFolder}/work_dirs/eval1"
42+
// ],
43+
// "env": {
44+
// "PYTHONPATH": "${workspaceFolder}/..:${env:PYTHONPATH}"
45+
// },
46+
// "console": "integratedTerminal"
47+
// }
48+
// ]
49+
// }

projects/mmdet3d_plugin/datasets/data_utils/data_utils.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def output_to_nusc_box(detection):
2828
box_yaw = box3d.yaw.numpy()
2929
# TODO: check whether this is necessary
3030
# with dir_offset & dir_limit in the head
31-
# TODO(box3d): convert bbox_yaw and bbox_dims to mmdet3d v1.0.0rc6 format.
32-
box_yaw = -box_yaw - np.pi / 2
31+
# TODO(box3d): convert bbox_yaw and bbox_dims to mmdet3d v1.0.0rc6 format. [DONE]
32+
# box_yaw = -box_yaw - np.pi / 2
3333

3434
box_list = []
3535
for i in range(len(box3d)):
@@ -78,8 +78,8 @@ def output_to_nusc_box_det(detection):
7878
box_yaw = box3d.yaw.numpy()
7979
# TODO: check whether this is necessary
8080
# with dir_offset & dir_limit in the head
81-
# TODO(box3d): convert bbox_yaw and bbox_dims to mmdet3d v1.0.0rc6 format.
82-
box_yaw = -box_yaw - np.pi / 2
81+
# TODO(box3d): convert bbox_yaw and bbox_dims to mmdet3d v1.0.0rc6 format. [DONE]
82+
# box_yaw = -box_yaw - np.pi / 2
8383

8484
box_list = []
8585
for i in range(len(box3d)):

projects/mmdet3d_plugin/datasets/data_utils/trajectory_api.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ def prepare_sdc_vel_info(self):
148148

149149
def generate_sdc_info(self, sdc_vel, as_lidar_instance3d_box=False):
150150
# sdc dim from https://forum.nuscenes.org/t/dimensions-of-the-ego-vehicle-used-to-gather-data/550
151-
# TODO(box3d): we have changed yaw to mmdet3d 1.0.0rc6 format, maybe we should change this.
152-
psudo_sdc_bbox = np.array([0.0, 0.0, 0.0, 1.73, 4.08, 1.56, -np.pi])
151+
# TODO(box3d): we have changed yaw to mmdet3d 1.0.0rc6 format, wlh->lwh -pi->0.5pi
152+
psudo_sdc_bbox = np.array([0.0, 0.0, 0.0, 4.08, 1.73, 1.56, 0.5*np.pi])
153153
if self.with_velocity:
154154
psudo_sdc_bbox = np.concatenate([psudo_sdc_bbox, sdc_vel], axis=-1)
155155
gt_bboxes_3d = np.array([psudo_sdc_bbox]).astype(np.float32)

projects/mmdet3d_plugin/uniad/dense_heads/motion_head_plugin/motion_utils.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ def nonlinear_smoother(gt_bboxes_3d, gt_fut_traj, gt_fut_traj_mask, bbox_tensor)
3434
gt_fut_traj_xy_diff = np.diff(gt_fut_traj_xy_diff, axis=1)
3535
gt_fut_traj_yaw = np.arctan2(
3636
gt_fut_traj_xy_diff[:, :, 1], gt_fut_traj_xy_diff[:, :, 0])
37-
# TODO(box3d): we have changed yaw to mmdet3d 1.0.0rc6 format, maybe we should change this.
37+
# TODO(box3d): we have changed yaw to mmdet3d 1.0.0rc6 format, maybe we should change this. [DONE]
3838
gt_fut_traj_yaw = np.concatenate(
39-
[-np.pi/2 - gt_bboxes_3d[:, None, 6:7], gt_fut_traj_yaw[:, :, None]], axis=1)
39+
[gt_bboxes_3d[:, None, 6:7], gt_fut_traj_yaw[:, :, None]], axis=1)
4040
gt_fut_traj = np.concatenate(
4141
[gt_bboxes_3d[:, None, :2], gt_fut_traj], axis=1)
4242

@@ -71,9 +71,9 @@ def _check_ade(traj_pert, traj_ref, thres):
7171
perturb_used_count = 0
7272
for i in range(gt_fut_traj.shape[0]):
7373
ts = ts_limit[i]
74-
# TODO(box3d): we have changed yaw to mmdet3d 1.0.0rc6 format, maybe we should change this.
75-
x_curr = [bbox_tensor[i, 0], bbox_tensor[i, 1], -
76-
np.pi/2 - yaw_preds[i], speed_preds[i]]
74+
# TODO(box3d): we have changed yaw to mmdet3d 1.0.0rc6 format, maybe we should change this. [DONE]
75+
x_curr = [bbox_tensor[i, 0], bbox_tensor[i, 1],
76+
yaw_preds[i], speed_preds[i]]
7777
reference_trajectory = np.concatenate(
7878
[gt_fut_traj[i], gt_fut_traj_yaw[i]], axis=-1)
7979
if ts > 1 and _is_dynamic(gt_fut_traj[i], int(ts), 2) and _check_diff(x_curr, reference_trajectory):

projects/mmdet3d_plugin/uniad/dense_heads/seg_head_plugin/seg_assigner.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def assign(self,
266266
cost = cls_cost + reg_cost + iou_cost
267267

268268
# 3. do Hungarian matching on CPU using linear_sum_assignment
269-
cost = cost.detach().cpu()
269+
cost = cost.detach()
270270

271271
assigned_gt_inds[:] = 0
272272
#index_set = []
@@ -276,14 +276,15 @@ def assign(self,
276276
'to install scipy first.')
277277
result=None
278278
for i in range(min(self.max_pos, 300//num_gts)):
279+
cost = cost.cpu()
279280
matched_row_inds, matched_col_inds = linear_sum_assignment(cost)
280281

281282
matched_row_inds = torch.from_numpy(matched_row_inds).to(
282283
bbox_pred.device)
283284
matched_col_inds = torch.from_numpy(matched_col_inds).to(
284285
bbox_pred.device)
285286
#print(matched_row_inds)
286-
287+
cost = cost.to(bbox_pred.device)
287288
cost[matched_row_inds,:] = INF
288289
#index_set.(matched_row_inds)
289290
#print('this mathed row inds ', len(matched_row_inds), i)

tools/analysis_tools/visualize/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ def __init__(self,
102102
self.pred_label = pred_label
103103
self.pred_center = pred_center
104104
self.pred_dim = pred_dim
105-
# TODO(box3d): we have changed yaw to mmdet3d 1.0.0rc6 format, maybe we should change this.
106-
self.pred_yaw = -pred_yaw-np.pi/2
105+
# TODO(box3d): we have changed yaw to mmdet3d 1.0.0rc6 format, maybe we should change this. [DONE]
106+
self.pred_yaw = pred_yaw
107107
self.pred_vel = pred_vel
108108
self.pred_traj = pred_traj
109109
self.pred_traj_score = pred_traj_score

tools/data_converter/uniad_nuscenes_converter.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,8 @@ def _fill_trainval_infos(nusc,
335335
names[i] = NuScenesDataset.NameMapping[names[i]]
336336
names = np.array(names)
337337
# instance_inds = [nusc.getind('instance', ann['instance_token']) for ann in annotations]
338-
# TODO(box3d): convert gt_boxes to mmdet3d 1.0.0rc6 LiDARInstance3DBoxes format.
339-
gt_boxes = np.concatenate([locs, dims, -rots - np.pi / 2], axis=1)
338+
# TODO(box3d): convert gt_boxes to mmdet3d 1.0.0rc6 LiDARInstance3DBoxes format. [DONE]
339+
gt_boxes = np.concatenate([locs, dims, rots], axis=1)
340340
# gt_boxes = np.concatenate([locs, dims[:, [1, 0, 2]], rots], axis=1)
341341
assert len(gt_boxes) == len(
342342
annotations), f'{len(gt_boxes)}, {len(annotations)}'

0 commit comments

Comments
 (0)