def __call__(self, res, info): voxel_size = self.voxel_generator.voxel_size # [0.05, 0.05, 0.1 ] pc_range = self.voxel_generator.point_cloud_range # [0, -40, -3, 70.4, 40, 1] grid_size = self.voxel_generator.grid_size # [1408, 1600, 40] # remove those gt_boxes (after gt-aug, per-object-aug, and global-aug) out of valid bv_range if res["mode"] == "train": gt_dict = res["lidar"]["annotations"] bv_range = pc_range[[0, 1, 3, 4]] # [ 0. , -40. , 70.4, 40. ], # todo: try get_valid_mask_by_pc_valid_range in preprocess.py, how about z-axis mask = prep.filter_gt_box_outside_range(gt_dict["gt_boxes"], bv_range) _dict_select(gt_dict, mask) res["lidar"]["annotations"] = gt_dict self.shuffle = True points = res["lidar"]["points"] if self.far_points_first: points = box_np_ops.far_points_first(points, 40.0, self.max_voxel_num, self.shuffle) voxels, coordinates, num_points_per_voxel = self.voxel_generator.generate( points) num_voxels = np.array([voxels.shape[0]], dtype=np.int64) # pack voxelization result res["lidar"]["voxels"] = dict( voxels=voxels, coordinates=coordinates, num_points=num_points_per_voxel, num_voxels=num_voxels, shape=grid_size, ) return res, info
def __call__(self, res, info): # [0, -40, -3, 70.4, 40, 1] voxel_size = self.voxel_generator.voxel_size pc_range = self.voxel_generator.point_cloud_range grid_size = self.voxel_generator.grid_size # [352, 400] if res["mode"] == "train": gt_dict = res["lidar"]["annotations"] bv_range = pc_range[[0, 1, 3, 4]] mask = prep.filter_gt_box_outside_range(gt_dict["gt_boxes"], bv_range) _dict_select(gt_dict, mask) res["lidar"]["annotations"] = gt_dict # points = points[:int(points.shape[0] * 0.1), :] voxels, coordinates, num_points = self.voxel_generator.generate( res["lidar"]["points"] ) num_voxels = np.array([voxels.shape[0]], dtype=np.int64) res["lidar"]["voxels"] = dict( voxels=voxels, coordinates=coordinates, num_points=num_points, num_voxels=num_voxels, shape=grid_size, ) return res, info
def __call__(self, res, info): voxel_size = self.voxel_generator.voxel_size # [0.05, 0.05, 0.1 ] pc_range = self.voxel_generator.point_cloud_range # [0, -40, -3, 70.4, 40, 1] grid_size = self.voxel_generator.grid_size # [1408, 1600, 40] # remove gt_boxes out of bv_range if res["mode"] == "train": gt_dict = res["lidar"]["annotations"] bv_range = pc_range[[0, 1, 3, 4]] # [ 0. , -40. , 70.4, 40. ], # todo: try get_valid_mask_by_pc_valid_range in preprocess.py, how about z-axis mask = prep.filter_gt_box_outside_range(gt_dict["gt_boxes"], bv_range) _dict_select(gt_dict, mask) res["lidar"]["annotations"] = gt_dict # todo: how about the points out of pc_valid_range voxels, coordinates, num_points = self.voxel_generator.generate( res["lidar"]["points"]) num_voxels = np.array([voxels.shape[0]], dtype=np.int64) # pack voxelization result res["lidar"]["voxels"] = dict( voxels=voxels, coordinates=coordinates, num_points=num_points, num_voxels=num_voxels, shape=grid_size, ) return res, info
def __call__(self, res, info): voxel_size = self.voxel_generator.voxel_size pc_range = self.voxel_generator.point_cloud_range grid_size = self.voxel_generator.grid_size if res["mode"] == "train": gt_dict = res["lidar"]["annotations"] bv_range = pc_range[[0, 1, 3, 4]] mask = prep.filter_gt_box_outside_range(gt_dict["gt_boxes"], bv_range) _dict_select(gt_dict, mask) res["lidar"]["annotations"] = gt_dict # points = points[:int(points.shape[0] * 0.1), :] points = res["lidar"]["points"] if self.include_pt_to_voxel: voxels, coordinates, num_points, pt_to_voxel = self.voxel_generator.generate( points) else: voxels, coordinates, num_points = self.voxel_generator.generate( points) num_voxels = np.array([voxels.shape[0]], dtype=np.int64) res["lidar"]["voxels"] = dict( voxels=voxels, coordinates=coordinates, num_points=num_points, num_voxels=num_voxels, shape=grid_size, ) if self.include_pt_to_voxel: res["lidar"]["voxels"]["pt_to_voxel"] = pt_to_voxel if "valid_idx" in res["lidar"]: # panoview projector is used valid_idx = res["lidar"]["valid_idx"] return res, info
def __call__(self, res, info): pc_range = self.voxel_generator.point_cloud_range # [0, -40, -3, 70.4, 40, 1] grid_size = self.voxel_generator.grid_size # [1408, 1600, 40] if res["mode"] == "train" and res['labeled']: gt_dict = res["lidar"]["annotations"] bv_range = pc_range[[0, 1, 3, 4]] # [ 0. , -40. , 70.4, 40. ], mask = prep.filter_gt_box_outside_range(gt_dict["gt_boxes"], bv_range) _dict_select(gt_dict, mask) res["lidar"]["annotations"] = gt_dict self.shuffle = True points = res["lidar"]["points"] voxels, coordinates, num_points_per_voxel = self.voxel_generator.generate( points) num_voxels = np.array([voxels.shape[0]], dtype=np.int64) res["lidar"]["voxels"] = dict( voxels=voxels, coordinates=coordinates, num_points=num_points_per_voxel, num_voxels=num_voxels, shape=grid_size, ) # voxelization of raw points without transformation if "points_raw" in res["lidar"].keys(): points_raw = res["lidar"]["points_raw"] voxels_raw, coordinates_raw, num_points_per_voxel_raw = self.voxel_generator.generate( points_raw) num_voxels_raw = np.array([voxels_raw.shape[0]], dtype=np.int64) res["lidar"]["voxels_raw"] = dict( voxels=voxels_raw, coordinates=coordinates_raw, num_points=num_points_per_voxel_raw, num_voxels=num_voxels_raw, shape=grid_size, ) return res, info
def __call__(self, res, info): voxel_size = self.voxel_generator.voxel_size pc_range = self.voxel_generator.point_cloud_range grid_size = self.voxel_generator.grid_size if res["mode"] == "train": gt_dict = res["lidar"]["annotations"] bv_range = pc_range[[0, 1, 3, 4]] mask = prep.filter_gt_box_outside_range(gt_dict["gt_boxes"], bv_range) _dict_select(gt_dict, mask) res["lidar"]["annotations"] = gt_dict max_voxels = self.max_voxel_num[0] else: max_voxels = self.max_voxel_num[1] voxels, coordinates, num_points = self.voxel_generator.generate( res["lidar"]["points"], max_voxels=max_voxels ) num_voxels = np.array([voxels.shape[0]], dtype=np.int64) res["lidar"]["voxels"] = dict( voxels=voxels, coordinates=coordinates, num_points=num_points, num_voxels=num_voxels, shape=grid_size, range=pc_range, size=voxel_size ) double_flip = self.double_flip and (res["mode"] != 'train') if double_flip: flip_voxels, flip_coordinates, flip_num_points = self.voxel_generator.generate( res["lidar"]["yflip_points"] ) flip_num_voxels = np.array([flip_voxels.shape[0]], dtype=np.int64) res["lidar"]["yflip_voxels"] = dict( voxels=flip_voxels, coordinates=flip_coordinates, num_points=flip_num_points, num_voxels=flip_num_voxels, shape=grid_size, range=pc_range, size=voxel_size ) flip_voxels, flip_coordinates, flip_num_points = self.voxel_generator.generate( res["lidar"]["xflip_points"] ) flip_num_voxels = np.array([flip_voxels.shape[0]], dtype=np.int64) res["lidar"]["xflip_voxels"] = dict( voxels=flip_voxels, coordinates=flip_coordinates, num_points=flip_num_points, num_voxels=flip_num_voxels, shape=grid_size, range=pc_range, size=voxel_size ) flip_voxels, flip_coordinates, flip_num_points = self.voxel_generator.generate( res["lidar"]["double_flip_points"] ) flip_num_voxels = np.array([flip_voxels.shape[0]], dtype=np.int64) res["lidar"]["double_flip_voxels"] = dict( voxels=flip_voxels, coordinates=flip_coordinates, num_points=flip_num_points, num_voxels=flip_num_voxels, shape=grid_size, range=pc_range, size=voxel_size ) return res, info