Skip to content
New issue

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

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

Already on GitHub? # to your account

[Fix] lidar2cam error in update_infos_to_v2.py for nus and lyft dataset. #2110

Merged
Merged
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
28 changes: 16 additions & 12 deletions tools/dataset_converters/update_infos_to_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,10 @@ def update_nuscenes_infos(pkl_path, out_dir):
ori_sweep['ego2global_rotation'],
ori_sweep['ego2global_translation'])
lidar2sensor = np.eye(4)
lidar2sensor[:3, :3] = ori_sweep['sensor2lidar_rotation'].T
lidar2sensor[:3, 3] = -ori_sweep['sensor2lidar_translation']
rot = ori_sweep['sensor2lidar_rotation']
trans = ori_sweep['sensor2lidar_translation']
lidar2sensor[:3, :3] = rot.T
lidar2sensor[:3, 3] = -1 * np.matmul(rot.T, trans.reshape(3, 1))
temp_lidar_sweep['lidar_points'][
'lidar2sensor'] = lidar2sensor.astype(np.float32).tolist()
temp_lidar_sweep['timestamp'] = ori_sweep['timestamp'] / 1e6
Expand All @@ -328,10 +330,10 @@ def update_nuscenes_infos(pkl_path, out_dir):
ori_info_dict['cams'][cam]['sensor2ego_rotation'],
ori_info_dict['cams'][cam]['sensor2ego_translation'])
lidar2sensor = np.eye(4)
lidar2sensor[:3, :3] = ori_info_dict['cams'][cam][
'sensor2lidar_rotation'].T
lidar2sensor[:3, 3] = -ori_info_dict['cams'][cam][
'sensor2lidar_translation']
rot = ori_info_dict['cams'][cam]['sensor2lidar_rotation']
trans = ori_info_dict['cams'][cam]['sensor2lidar_translation']
lidar2sensor[:3, :3] = rot.T
lidar2sensor[:3, 3] = -1 * np.matmul(rot.T, trans.reshape(3, 1))
empty_img_info['lidar2cam'] = lidar2sensor.astype(
np.float32).tolist()
temp_data_info['images'][cam] = empty_img_info
Expand Down Expand Up @@ -781,8 +783,10 @@ def update_lyft_infos(pkl_path, out_dir):
ori_sweep['ego2global_rotation'],
ori_sweep['ego2global_translation'])
lidar2sensor = np.eye(4)
lidar2sensor[:3, :3] = ori_sweep['sensor2lidar_rotation'].T
lidar2sensor[:3, 3] = -ori_sweep['sensor2lidar_translation']
rot = ori_sweep['sensor2lidar_rotation']
trans = ori_sweep['sensor2lidar_translation']
lidar2sensor[:3, :3] = rot.T
lidar2sensor[:3, 3] = -1 * np.matmul(rot.T, trans.reshape(3, 1))
temp_lidar_sweep['lidar_points'][
'lidar2sensor'] = lidar2sensor.astype(np.float32).tolist()
# bc-breaking: Timestamp has divided 1e6 in pkl infos.
Expand All @@ -807,10 +811,10 @@ def update_lyft_infos(pkl_path, out_dir):
ori_info_dict['cams'][cam]['sensor2ego_rotation'],
ori_info_dict['cams'][cam]['sensor2ego_translation'])
lidar2sensor = np.eye(4)
lidar2sensor[:3, :3] = ori_info_dict['cams'][cam][
'sensor2lidar_rotation'].T
lidar2sensor[:3, 3] = -ori_info_dict['cams'][cam][
'sensor2lidar_translation']
rot = ori_info_dict['cams'][cam]['sensor2lidar_rotation']
trans = ori_info_dict['cams'][cam]['sensor2lidar_translation']
lidar2sensor[:3, :3] = rot.T
lidar2sensor[:3, 3] = -1 * np.matmul(rot.T, trans.reshape(3, 1))
empty_img_info['lidar2cam'] = lidar2sensor.astype(
np.float32).tolist()
temp_data_info['images'][cam] = empty_img_info
Expand Down