From 0f607ef334b28d6c7f85d19b7bac577e59ed44cd Mon Sep 17 00:00:00 2001 From: lianqing Date: Wed, 7 Dec 2022 09:45:53 +0800 Subject: [PATCH 1/2] fix lidar2cam error on nus and lyft --- tools/dataset_converters/update_infos_to_v2.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/dataset_converters/update_infos_to_v2.py b/tools/dataset_converters/update_infos_to_v2.py index bbd6a1bb8..d5ae58a1f 100644 --- a/tools/dataset_converters/update_infos_to_v2.py +++ b/tools/dataset_converters/update_infos_to_v2.py @@ -328,10 +328,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 @@ -807,10 +807,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 From 36bee67328445380b0a51d21c29566ac33e842c2 Mon Sep 17 00:00:00 2001 From: lianqing Date: Fri, 9 Dec 2022 19:52:23 +0800 Subject: [PATCH 2/2] fix lidar2cam error in sweep --- tools/dataset_converters/update_infos_to_v2.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/dataset_converters/update_infos_to_v2.py b/tools/dataset_converters/update_infos_to_v2.py index d5ae58a1f..cb38ed797 100644 --- a/tools/dataset_converters/update_infos_to_v2.py +++ b/tools/dataset_converters/update_infos_to_v2.py @@ -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 @@ -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.