LiDAR-Fusion Chapter 3 - Train PointPainting Model
In this chapter, we will train the PointPainting model based on the fused Painted Kitti Dataset.
Now, we will change our working directory from painting
to detector
.
Generate Training Configuration
Here is a script gen_painted_kitti_config.py
under the detector
directory. It will scan the whole dataset and filter some useless elements. It will also generate some configurations for later training based on the values in tools/cfgs/dataset_configs/painted_kitti_dataset
. Just run the following command:
python gen_painted_kitti_config.py tools/cfgs/dataset_configs/painted_kitti_dataset.yaml
It will generate the configurations to some .pkl
files under detector/data/kitti/
.
Train the Model
Go to detector/tools
, and run the command below to train the model:
python train.py --cfg_file cfgs/kitti_models/pointpillar_painted.yaml --epochs 1
Here I set the training epoch to 1 for quickly running through the whole training procedure in order to prevent discovering some bugs when the training is about to finish which may waste a bunch of time.
There are more configurations that you can adjust. For more details, you can run this command to see:
python train.py --help
Multi-GPU Training
If you are using a multi-GPU platform, you can use the following command to accelerate training:
OMP_NUM_THREADS=8 torchrun --nproc_per_node=4 train.py --cfg_file cfgs/kitti_models/pointpillar_painted.yaml --launcher pytorch
Get the Result
Once finishing the training, you can see the result stored in detector/output
.