Skip to content

Latest commit

 

History

History
91 lines (79 loc) · 3.52 KB

NUSCENES_PREPROCESSING.md

File metadata and controls

91 lines (79 loc) · 3.52 KB

Download nuScenes dataset and convert it to KITTI format

Download nuScenes dataset from https://www.nuscenes.org/nuscenes#download and decompress it into NUSCENES_ROOT. Install nuScenes Dataset SDK (https://github.com/nutonomy/nuscenes-devkit) and some prerequisites:

pip install nuscenes-devkit
pip install pyquaternion fire matplotlib

We have been experimenting with v1.0 nuScenes dataset.

Convert the nuScenes dataset into KITTI format to NUSCENES_KITTI_FORMAT and NUSCENES_KITTI_FORMAT_20HZ by

cd data_processing/nuscenes
# nuScenes labels the LiDAR by 2Hz. We first extract the annotated portion
python nusc2kitti_boston.py --nusc_dir NUSCENES_ROOT --nusc_kitti_dir NUSCENES_KITTI_FORMAT

# then extract the full 20hz portion
python nusc2kitti_boston.py --nusc_dir NUSCENES_ROOT --nusc_kitti_dir NUSCENES_KITTI_FORMAT_20HZ --disable_convert_labels --disable_convert_images

[Optional] Obtain the train/test split

You can skip the following by directly using the uploaded files in data_preprocessing/nuscenes/meta_data/. We include the corresponding scripts to generate the splits as follows.

The train/test split of the traversals by their geo-location is generated by the following commands.

cd data_processing/nuscenes
python split_traintest.py --data_20hz_root NUSCENES_KITTI_FORMAT_20HZ

It will generate

data_preprocessing/nuscenes/meta_data/track_list.pkl
data_preprocessing/nuscenes/meta_data/valid_idx_info.pkl
data_preprocessing/nuscenes/meta_data/train_idx.txt # 3985 samples
data_preprocessing/nuscenes/meta_data/test_idx.txt # 2324 samples

Gather dense historical traversals

cd data_processing
python gather_historical_traversals.py --track_path nuscenes/meta_data/track_list.pkl \
    --idx_info nuscenes/meta_data/valid_idx_info.pkl \
    --data_root NUSCENES_KITTI_FORMAT_20HZ \
    --traversal_ptc_save_root NUSCENES_KITTI_FORMAT/training/combined_lidar \
    --trans_mat_save_root NUSCENES_KITTI_FORMAT/training/trans_mat \
    --nusc

Generate ground planes for detection training

cd data_processing
python RANSAC.py --calib_dir NUSCENES_KITTI_FORMAT/training/calib \
    --lidar_dir NUSCENES_KITTI_FORMAT/training/velodyne \
    --planes_dir NUSCENES_KITTI_FORMAT/training/planes --min_h 1.3 --max_h 2.0

Generate background sample for detection training

Please see the descriptions in Lyft counterparts.

To generate the background sample:

cd data_processing
python generate_background_samples.py --save_dir NUSCENES_KITTI_FORMAT/training/bg_samples \
    --voxel_size 0.4 --data_root NUSCENES_KITTI_FORMAT_20HZ \
    --label_dir NUSCENES_KITTI_FORMAT/training/label_2 \
    --calib_dir NUSCENES_KITTI_FORMAT/training/calib \
    --trans_mat_dir LYFT_KITTI_FORMAT/training/trans_mat \
    --mata_file_root nuscenes/meta_data \
    --track_path nuscenes/meta_data/track_list.pkl \
    --idx_info nuscenes/meta_data/valid_idx_info.pkl \
    --idx_list nuscenes/meta_data/train_idx.txt \
    --nusc

The background samples are stored in NUSCENES_KITTI_FORMAT/training/bg_samples.

Setup for detection training

Create soft links to nuscenes dataset:

cd downstream/OpenPCDet/data/nuscenes_boston
ln -s NUSCENES_KITTI_FORMAT/training

After installing OpenPCDet, run

cd downstream/OpenPCDet/
python -m pcdet.datasets.kitti.kitti_dataset create_kitti_infos tools/cfgs/dataset_configs/nuscenes_boston.yaml