Note: This current version of code is largely based on MonoScene, and many thanks to this great work. You can take it as an independent repo. We are working to integrate it with our own code.
- Create conda environment:
$ conda create -y -n kitti_ssc python=3.8
$ conda activate kitti_ssc
- This code was implemented with python 3.8, pytorch 1.7.1 and CUDA 11.0. Please install PyTorch:
$ pip install torch==1.7.1+cu110 torchvision==0.8.2+cu110 -f https://download.pytorch.org/whl/torch_stable.html
- Install torchmetrics:
$ pip install torchmetrics==0.6.0
- Install the additional dependencies:
$ cd kitti_ssc
$ pip install -r requirements.txt
- Install tbb:
$ conda install -c bioconda tbb=2020.2
- Install mmcv, mmsegmentation, mmdet:
$ pip install -U openmim
$ mim install mmcv_full==1.4.0
$ mim install mmdet==2.14.0
$ mim install mmsegmentation==0.14.1
- Finally, install kitti_ssc:
$ pip install -e ./
-
You need to download
- The Semantic Scene Completion dataset v1.1 (SemanticKITTI voxel data (700 MB)) from SemanticKITTI website
- The KITTI Odometry Benchmark calibration data (Download odometry data set (calibration files, 1 MB)) and the RGB images (Download odometry data set (color, 65 GB)) from KITTI Odometry website.
-
Create a folder to store SemanticKITTI preprocess data at
/path/to/kitti/preprocess/folder
. -
Store paths in environment variables for faster access (Note: folder 'dataset' is in /path/to/semantic_kitti):
$ export KITTI_PREPROCESS=/path/to/kitti/preprocess/folder
$ export KITTI_ROOT=/path/to/semantic_kitti
- Preprocess the data to generate labels at a lower scale, which are used to compute the ground truth relation matrices:
$ cd kitti_ssc/
$ python kitti_ssc/dataset/semantic_kitti/preprocess.py kitti_root=$KITTI_ROOT kitti_preprocess_root=$KITTI_PREPROCESS
Download TPVFormer pretrained models on SemanticKITTI, then put them in the folder TPVFormer/kitti_ssc/ckpts/tpv10/
.
To train TPVFormer with SemanticKITTI, type:
-
Create folders to store training logs at /path/to/kitti/logdir.
-
Store in an environment variable:
$ export KITTI_LOG=/path/to/kitti/logdir
- Train TPVFormer using 4 GPUs with batch_size of 4 (1 item per GPU) on Semantic KITTI:
$ cd kitti_ssc/
$ python kitti_ssc/scripts/train_kitti_ssc.py \
dataset=kitti \
enable_log=true \
kitti_root=$KITTI_ROOT \
kitti_preprocess_root=$KITTI_PREPROCESS\
kitti_logdir=$KITTI_LOG \
n_gpus=4 batch_size=4 context_prior=false \
model_cfg=../../../configs/tpv10_lr_wd_layer.py
To evaluate TPVFormer on SemanticKITTI validation set, type:
$ cd kitti_ssc/
$ python kitti_ssc/scripts/eval_kitti_ssc.py \
dataset=kitti \
kitti_root=$KITTI_ROOT \
kitti_preprocess_root=$KITTI_PREPROCESS \
n_gpus=1 batch_size=1 context_prior=false \
model_cfg=../../../configs/tpv10_lr_wd_layer.py \
+model_path=../../../ckpts/tpv10/model.ckpt