DFormer: Rethinking RGBD Representation Learning for Semantic Segmentation (ICLR 2024)
Authors: Bowen Yin, Xuying Zhang, Zhongyu Li, Li Liu, Ming-Ming Cheng, Qibin Hou*
Paper Link | Homepage | 公众号解读(集智书童) | DFormer-SOD |
🤖RGBD-Pretrain(You can train your own encoders)
⚓Application to new datasets(添加新数据集)
This official repository of 'DFormer: Rethinking RGBD Representation Learning for Semantic Segmentation'. We provide the RGBD pretraining code in RGBD-Pretrain. You can pretrain more powerful RGBD encoders and contribute to the RGBD research.
We invite all to contribute in making it more acessible and useful. If you have any questions about our work, feel free to contact me via e-mail (bowenyin@mail.nankai.edu.cn). If you are using our code and evaluation toolbox for your research, please cite this paper (BibTeX).
Figure 1: Comparisons between the existing methods and our DFormer (RGB-D Pre-training).
1. 🌟 NEWS
- [2024/01/16] Our DFormer has been accpeted by The International Conference on Learning Representations (ICLR 2024).
2. 🚀 Get Start
0. Install
conda create -n dformer python=3.10 -y
conda activate dformer
pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio==0.11.0 --extra-index-url https://download.pytorch.org/whl/cu113
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.11/index.html
pip install tqdm opencv-python scipy tensorboardX tabulate easydict
1. Download Datasets and Checkpoints.
- Datasets:
By default, you can put datasets into the folder 'datasets' or use 'ln -s path_to_data datasets'.
Datasets | GoogleDrive | OneDrive | BaiduNetdisk |
---|
Compred to the original datasets, we map the depth (.npy) to .png via 'plt.imsave(save_path, np.load(depth), cmap='Greys_r')', reorganize the file path to a clear format, and add the split files (.txt).
- Checkpoints:
ImageNet-1K Pre-trained DFormers T/S/B/L and NYUDepth or SUNRGBD trained DFormers T/S/B/L can be downloaded at:
Weights | GoogleDrive | OneDrive | BaiduNetdisk |
---|---|---|---|
Pretrained | GoogleDrive | OneDrive | BaiduNetdisk |
NYUDepthv2 (57.2mIoU) | GoogleDrive | OneDrive | BaiduNetdisk |
SUNRGBD (52.5mIoU) | GoogleDrive | OneDrive | BaiduNetdisk |
Orgnize the checkpoints and dataset folder in the following structure:
<checkpoints> |-- <pretrained> |-- <DFormer_Large.pth.tar> |-- <DFormer_Base.pth.tar> |-- <DFormer_Small.pth.tar> |-- <DFormer_Tiny.pth.tar> |-- <trained> |-- <NYUDepthv2> |-- ... |-- <SUNRGBD> |-- ... <datasets> |-- <DatasetName1> |-- <RGB> |-- <name1>.<ImageFormat> |-- <name2>.<ImageFormat> ... |-- <Depth> |-- <name1>.<DepthFormat> |-- <name2>.<DepthFormat> |-- train.txt |-- test.txt |-- <DatasetName2> |-- ...
2. Train.
You can change the `local_config' files in the script to choose the model for training.
bash train.sh
After training, the checkpoints will be saved in the path `checkpoints/XXX', where the XXX is depends on the training config.
3. Eval.
You can change the `local_config' files and checkpoint path in the script to choose the model for testing.
bash eval.sh
4. Visualize.
bash infer.sh
🚩 Performance
🕙 ToDo
- Tutorial on applying the DFormer encoder to the frameworks of other tasks
- Release the code of RGB-D pre-training.
[-] Tutorial on applying to a new dataset.[-] Release the DFormer code for RGB-D salient obejct detection.
We invite all to contribute in making it more acessible and useful. If you have any questions or suggestions about our work, feel free to contact me via e-mail (bowenyin@mail.nankai.edu.cn) or raise an issue.
Reference
You may want to cite:
@article{yin2023dformer,
title={DFormer: Rethinking RGBD Representation Learning for Semantic Segmentation},
author={Yin, Bowen and Zhang, Xuying and Li, Zhongyu and Liu, Li and Cheng, Ming-Ming and Hou, Qibin},
journal={arXiv preprint arXiv:2309.09668},
year={2023}
}
Acknowledgment
Our implementation is mainly based on mmsegmentaion, CMX and CMNext. Thanks for their authors.
License
Code in this repo is for non-commercial use only.