The official code and data for the benchmark with baselines for our paper: Cam4DOcc: Benchmark for Camera-Only 4D Occupancy Forecasting in Autonomous Driving Applications
This work has been accepted by CVPR 2024 🎉
Junyi Ma#, Xieyuanli Chen#, Jiawei Huang, Jingyi Xu, Zhen Luo, Jintao Xu, Weihao Gu, Rui Ai, Hesheng Wang*
If you use Cam4DOcc in an academic work, please cite our paper:
@inproceedings{ma2024cvpr,
author = {Junyi Ma and Xieyuanli Chen and Jiawei Huang and Jingyi Xu and Zhen Luo and Jintao Xu and Weihao Gu and Rui Ai and Hesheng Wang},
title = {{Cam4DOcc: Benchmark for Camera-Only 4D Occupancy Forecasting in Autonomous Driving Applications}},
booktitle = {Proc.~of the IEEE/CVF Conf.~on Computer Vision and Pattern Recognition (CVPR)},
year = 2024
}
We follow the installation instructions of our codebase OpenOccupancy, which are also posted here:
- Create a conda virtual environment and activate it
conda create -n OpenOccupancy python=3.7 -y
conda activate OpenOccupancy
- Install PyTorch and torchvision (tested on torch==1.10.1 & cuda=11.3)
conda install pytorch==1.10.1 torchvision==0.11.2 torchaudio==0.10.1 cudatoolkit=11.3 -c pytorch -c conda-forge
- Install gcc>=5 in conda env
conda install -c omgarcia gcc-6
- Install mmcv, mmdet, and mmseg
pip install mmcv-full==1.4.0
pip install mmdet==2.14.0
pip install mmsegmentation==0.14.1
- Install mmdet3d from the source code
git clone https://github.com/open-mmlab/mmdetection3d.git
cd mmdetection3d
git checkout v0.17.1 # Other versions may not be compatible.
python setup.py install
- Install other dependencies
pip install timm
pip install open3d-python
pip install PyMCubes
pip install spconv-cu113
pip install fvcore
pip install setuptools==59.5.0
- Install occupancy pooling
git clone git@github.com:haomo-ai/Cam4DOcc.git
cd Cam4DOcc
export PYTHONPATH=“.”
python setup.py develop
Please link your nuScenes V1.0 full dataset to the data folder.
nuScenes-Occupancy, nuscenes_occ_infos_train.pkl, and nuscenes_occ_infos_val.pkl are also provided by the previous work. If you only want to reproduce the forecasting results with "inflated" form, nuScenes dataset and Cam4DOcc are all you need.
Note that the folders under cam4docc
will be generated automatically once you first run our training or evaluation scripts.
Cam4DOcc
├── data/
│ ├── nuscenes/
│ │ ├── maps/
│ │ ├── samples/
│ │ ├── sweeps/
│ │ ├── lidarseg/
│ │ ├── v1.0-test/
│ │ ├── v1.0-trainval/
│ │ ├── nuscenes_occ_infos_train.pkl/
│ │ ├── nuscenes_occ_infos_val.pkl/
│ ├── nuScenes-Occupancy/
│ ├── cam4docc
│ │ ├── segmentation/
│ │ ├── instance/
│ │ ├── flow/
We directly integrate the Cam4DOcc dataset generation pipeline into the dataloader, so you can directly run train or evaluate scripts and just wait 😏
Optionally, you can set only_generate_dataset=True
in Cam4DOcc/projects/configs/baselines/OCFNet_in_Cam4DOcc_V1.x.py
to only generate the Cam4DOcc data without model training and inference.
OCFNetV1.1 can forecast inflated GMO and others. In this case, vehicle and human are considered as one unified category.
bash run.sh ./projects/configs/baselines/OCFNet_in_Cam4DOcc_V1.1.py 8
OCFNetV1.2 can forecast inflated GMO including bicycle, bus, car, construction, motorcycle, trailer, truck, pedestrian, and others. In this case, vehicle and human are divided into multiple categories for clearer evaluation on forecasting performance.
bash run.sh ./projects/configs/baselines/OCFNet_in_Cam4DOcc_V1.2.py 8
bash run_eval.sh $PATH_TO_CFG $PATH_TO_CKPT $GPU_NUM
# e.g. bash run_eval.sh ./projects/configs/baselines/OCFNet_in_Cam4DOcc_V1.1.py ./work_dirs/OCFNet_in_Cam4DOcc_V1.1/epoch_20.pth 8
Some basic information as well as key parameters for our current version.
Type | Info | Parameter |
---|---|---|
train | 23,930 sequences | train_capacity |
val | 5,119 frames | test_capacity |
voxel size | 0.2m | voxel_x/y/z |
range | [-51.2m, -51.2m, -5m, 51.2m, 51.2m, 3m] | point_cloud_range |
volume size | [512, 512, 40] | occ_size |
classes | 2 for V1.1 / 9 for V1.2 | num_cls |
observation frames | 3 | time_receptive_field |
future frames | 4 | n_future_frames |
extension frames | 6 | n_future_frames_plus |
The tutorial is being refined ...
We will release our pretrained models as soon as possible. OCFNetV1.3 and OCFNetV2 are on their way ...
We thank the fantastic works OpenOccupancy, PowerBEV, and FIERY for their pioneer code release, which provide codebase for this benchmark.