Cascol-Chen / PointClouds_Segmantic_Visualize

32 stars 4 forks source link

any instruction for this project? #1

Open jiaminglei-lei opened 2 years ago

jiaminglei-lei commented 2 years ago

what's the content in data? how to generate point.bin, pred.bin and ground.bin?

By the way, SCUT in your name means 'South China University of Technology' ?

Cascol-Chen commented 2 years ago

Thanks for the first question, I will add instruction later. The project is aim for Nuscene, but can also be extended easily by changing the function loadPCD in tools/common.py, for example, you can change it as the code below to adapt to Semantic-Kitti Dataset

def loadPCD(path):
    points = np.fromfile(path, dtype=np.float32).reshape(-1, 4)
    points = points[:, :3]
    return 

As is aim for Nuscene, point.bin and ground.bin is the file for point and lidarseg provided in Nuscene, and pred.bin is what your model output for ground.bin under semantic segmentation task. You may want to know how to match point.bin and the corresponding ground.bin, here is an example

from pathlib import Path
from nuscenes import NuScenes
nusc = NuScenes(version='v1.0-trainval', dataroot='...', verbose=True)
cur_token = sample_token
ground_root = Path('root path of the ground truth lidarseg')
pred_root = Path('root path of the prediction output lidarseg')

storage = {}
for i in range(40):
    tmp = nusc.get('sample',cur_token)
    lidar_token = tmp['data']['LIDAR_TOP']
    storage[i]={
        'points': str(ground_root / nusc.get('sample_data', lidar_token)['filename']),
        'ground': str(ground_root / nusc.get('lidarseg', lidar_token)['filename']),
        'pred': str(pred_root / (lidar_token+'_lidarseg.bin'))
    }
    print(f'{i} lidar_top_file:', ground_root / nusc.get('sample_data', lidar_token)['filename'])
    print(f'{i} ground_truth_label', ground_root / nusc.get('lidarseg', lidar_token)['filename'])
    print(f'{i} pred_label', pred_root / (lidar_token+'_lidarseg.bin'))
    cur_token = tmp['next']

By the way, SCUT does mean for South China University of China and this project is part of my graduation project. hhh