MCPcopy
hub / github.com/open-mmlab/OpenPCDet / fill_trainval_infos

Function fill_trainval_infos

pcdet/datasets/lyft/lyft_utils.py:86–221  ·  view source on GitHub ↗
(data_path, lyft, train_scenes, val_scenes, test=False, max_sweeps=10)

Source from the content-addressed store, hash-verified

84
85
86def fill_trainval_infos(data_path, lyft, train_scenes, val_scenes, test=False, max_sweeps=10):
87 train_lyft_infos = []
88 val_lyft_infos = []
89 progress_bar = tqdm.tqdm(total=len(lyft.sample), desc='create_info', dynamic_ncols=True)
90
91 # ref_chans = ["LIDAR_TOP", "LIDAR_FRONT_LEFT", "LIDAR_FRONT_RIGHT"]
92 ref_chan = "LIDAR_TOP"
93
94 for index, sample in enumerate(lyft.sample):
95 progress_bar.update()
96
97 ref_info = {}
98 ref_sd_token = sample["data"][ref_chan]
99 ref_sd_rec = lyft.get("sample_data", ref_sd_token)
100 ref_cs_token = ref_sd_rec["calibrated_sensor_token"]
101 ref_cs_rec = lyft.get("calibrated_sensor", ref_cs_token)
102
103 ref_to_car = transform_matrix(
104 ref_cs_rec["translation"],
105 Quaternion(ref_cs_rec["rotation"]),
106 inverse=False,
107 )
108
109 ref_from_car = transform_matrix(
110 ref_cs_rec["translation"],
111 Quaternion(ref_cs_rec["rotation"]),
112 inverse=True,
113 )
114
115 ref_lidar_path = lyft.get_sample_data_path(ref_sd_token)
116
117 ref_boxes, ref_pose_rec = get_sample_data(lyft, ref_sd_token)
118 ref_time = 1e-6 * ref_sd_rec["timestamp"]
119 car_from_global = transform_matrix(
120 ref_pose_rec["translation"],
121 Quaternion(ref_pose_rec["rotation"]),
122 inverse=True,
123 )
124
125 car_to_global = transform_matrix(
126 ref_pose_rec["translation"],
127 Quaternion(ref_pose_rec["rotation"]),
128 inverse=False,
129 )
130
131 info = {
132 "lidar_path": Path(ref_lidar_path).relative_to(data_path).__str__(),
133 "ref_from_car": ref_from_car,
134 "ref_to_car": ref_to_car,
135 'token': sample['token'],
136 'car_from_global': car_from_global,
137 'car_to_global': car_to_global,
138 'timestamp': ref_time,
139 'sweeps': []
140 }
141
142 sample_data_token = sample['data'][ref_chan]
143 curr_sd_rec = lyft.get('sample_data', sample_data_token)

Callers

nothing calls this directly

Calls 3

updateMethod · 0.80
get_sample_dataFunction · 0.70
quaternion_yawFunction · 0.70

Tested by

no test coverage detected