JeffWang987 / OpenOccupancy

[ICCV 2023] OpenOccupancy: A Large Scale Benchmark for Surrounding Semantic Occupancy Perception
Apache License 2.0
590 stars 50 forks source link

About LoadOccupancy and Collect3D #38

Open yrsbsmy opened 1 year ago

yrsbsmy commented 1 year ago

hi,there are two questions that I really need your help. Firstly, where is the type = 'Collect3D' in pipline, I only find the 'class CustomOccCollect3D'. Secondly, There are some contradictions in 'LoadOccupancy':" def call(self, results): relpath = 'scene{0}/occupancy/{1}.npy'.format(results['scene_token'], results['lidar_token'])

[z y x cls] or [z y x vx vy vz cls]

    pcd = np.load(os.path.join(self.occ_path, rel_path))
    pcd_label = pcd[..., -1:]
    pcd_label[pcd_label==0] = 255
    pcd_np_cor = self.voxel2world(pcd[..., [2,1,0]] + 0.5)  # x y z
    untransformed_occ = copy.deepcopy(pcd_np_cor)  # N 4
    # bevdet augmentation
    pcd_np_cor = (results['bda_mat'] @ torch.from_numpy(pcd_np_cor).unsqueeze(-1).float()).squeeze(-1).numpy()
    pcd_np_cor = self.world2voxel(pcd_np_cor)

    # make sure the point is in the grid
    pcd_np_cor = np.clip(pcd_np_cor, np.array([0,0,0]), self.grid_size - 1)
    transformed_occ = copy.deepcopy(pcd_np_cor)
    pcd_np = np.concatenate([pcd_np_cor, pcd_label], axis=-1)

    # velocity
    if self.use_vel:
        pcd_vel = pcd[..., [3,4,5]]  # x y z
        pcd_vel = (results['bda_mat'] @ torch.from_numpy(pcd_vel).unsqueeze(-1).float()).squeeze(-1).numpy()
        pcd_vel = np.concatenate([pcd_np, pcd_vel], axis=-1)  # [x y z cls vx vy vz]
        results['gt_vel'] = pcd_vel

    # 255: noise, 1-16 normal classes, 0 unoccupied
    pcd_np = pcd_np[np.lexsort((pcd_np_cor[:, 0], pcd_np_cor[:, 1], pcd_np_cor[:, 2])), :]
    pcd_np = pcd_np.astype(np.int64)
    processed_label = np.ones(self.grid_size, dtype=np.uint8) * self.unoccupied
    processed_label = nb_process_label(processed_label, pcd_np)
    results['gt_occ'] = processed_label"

As far as I know, the rel_path should be the lidar-seg label.