Skip to content

Latest commit

 

History

History
132 lines (91 loc) · 5.42 KB

WAYMO.md

File metadata and controls

132 lines (91 loc) · 5.42 KB

Getting Started with CenterPoint on Waymo

Prerequisite

  • Follow INSTALL.md to install all required libraries.
  • Tensorflow
  • Waymo-open-dataset devkit
conda activate centerpoint 
pip install waymo-open-dataset-tf-1-15-0==1.2.0 

Prepare data

Download data and organise as follows

# For Waymo Dataset         
└── WAYMO_DATASET_ROOT
       ├── tfrecord_training       
       ├── tfrecord_validation   
       ├── tfrecord_testing 

Convert the tfrecord data to pickle files.

# train set 
CUDA_VISIBLE_DEVICES=-1 python det3d/datasets/waymo/waymo_converter.py --record_path 'WAYMO_DATASET_ROOT/tfrecord_training/*.tfrecord'  --root_path 'WAYMO_DATASET_ROOT/train/'

# validation set 
CUDA_VISIBLE_DEVICES=-1 python det3d/datasets/waymo/waymo_converter.py --record_path 'WAYMO_DATASET_ROOT/tfrecord_validation/*.tfrecord'  --root_path 'WAYMO_DATASET_ROOT/val/'

# testing set 
CUDA_VISIBLE_DEVICES=-1 python det3d/datasets/waymo/waymo_converter.py --record_path 'WAYMO_DATASET_ROOT/tfrecord_testing/*.tfrecord'  --root_path 'WAYMO_DATASET_ROOT/test/'

Create a symlink to the dataset root

mkdir data && cd data
ln -s WAYMO_DATASET_ROOT Waymo

Remember to change the WAYMO_DATASET_ROOT to the actual path in your system.

Create info files

# One Sweep Infos 
python tools/create_data.py waymo_data_prep --root_path=data/Waymo --split train --nsweeps=1

python tools/create_data.py waymo_data_prep --root_path=data/Waymo --split val --nsweeps=1

python tools/create_data.py waymo_data_prep --root_path=data/Waymo --split test --nsweeps=1

# Two Sweep Infos (for two sweep detection and tracking models)
python tools/create_data.py waymo_data_prep --root_path=data/Waymo --split train --nsweeps=2

python tools/create_data.py waymo_data_prep --root_path=data/Waymo --split val --nsweeps=2

python tools/create_data.py waymo_data_prep --root_path=data/Waymo --split test --nsweeps=2

In the end, the data and info files should be organized as follows

└── CenterPoint
       └── data    
              └── Waymo 
                     ├── tfrecord_training       
                     ├── tfrecord_validation
                     ├── train <-- all training frames and annotations 
                     ├── val   <-- all validation frames and annotations 
                     ├── test   <-- all testing frames and annotations 
                     ├── infos_train_01sweeps_filter_zero_gt.pkl
                     ├── infos_train_02sweeps_filter_zero_gt.pkl
                     ├── infos_val_01sweeps_filter_zero_gt.pkl
                     ├── infos_val_02sweeps_filter_zero_gt.pkl
                     ├── infos_test_01sweeps_filter_zero_gt.pkl
                     ├── infos_test_02sweeps_filter_zero_gt.pkl

Train & Evaluate in Command Line

Use the following command to start a distributed training using 4 GPUs. The models and logs will be saved to work_dirs/CONFIG_NAME.

python -m torch.distributed.launch --nproc_per_node=4 ./tools/train.py CONFIG_PATH

For distributed testing with 4 gpus,

python -m torch.distributed.launch --nproc_per_node=4 ./tools/dist_test.py CONFIG_PATH --work_dir work_dirs/CONFIG_NAME --checkpoint work_dirs/CONFIG_NAME/latest.pth 

For testing with one gpu and see the inference time,

python ./tools/dist_test.py CONFIG_PATH --work_dir work_dirs/CONFIG_NAME --checkpoint work_dirs/CONFIG_NAME/latest.pth --speed_test 

This will generate a my_preds.bin file in the work_dir. You can create submission to Waymo server using waymo-open-dataset code by following the instructions here.

If you want to do local evaluation (e.g. for a subset), generate the gt prediction bin files using the script below and follow the waymo instructions here.

python det3d/datasets/waymo/waymo_common.py --info_path data/Waymo/infos_val_01sweeps_filter_zero_gt.pkl --result_path data/Waymo/ --gt 

All pretrained models and configurations are in MODEL ZOO.

Second-stage Training

Our final model follows a two-stage training process. For example, to train the two-stage CenterPoint-Voxel model, you first need to train the one stage model using ONE_STAGE and then train the second stage module using TWO_STAGE. You can also contact us to access the pretrained models, see details here.

Tracking

Please refer to options in test.py. The prediction file is an intermediate file generated using dist_test.py that stores predictions in KITTI lidar format.

Visualization

Please refer to visual.py. It will take a prediction file generated by simple_inference_waymo.py and visualize the point cloud and detections.

Test Set

Add the --testset flag to the end.

python ./tools/dist_test.py CONFIG_PATH --work_dir work_dirs/CONFIG_NAME --checkpoint work_dirs/CONFIG_NAME/latest.pth --testset