VCIP-RGBD / DFormer

[ICLR 2024] DFormer: Rethinking RGBD Representation Learning for Semantic Segmentation
https://yinbow.github.io/Projects/DFormer/index.html
MIT License
152 stars 24 forks source link
iclr-2024 nyu-depth-v2 rgbd-representation-learning rgbd-segmentation sun-rgbd

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 |

:robot:RGBD-Pretrain(You can train your own encoders)

:anchor: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

2. 🚀 Get Start

0. Install

conda create -n dformer python=3.10 -y
conda activate dformer

# CUDA 11.8
conda install pytorch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 pytorch-cuda=11.8 -c pytorch -c nvidia

pip install mmcv==2.1.0 -f https://download.openmmlab.com/mmcv/dist/cu118/torch2.1/index.html

pip install tqdm opencv-python scipy tensorboardX tabulate easydict ftfy regex

1. Download Datasets and Checkpoints.

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).

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:


```shell

|-- 
    |-- 
    |-- 
    |-- 
    |-- 
|-- 
    |-- 
        |-- ...
    |-- 
        |-- ...

|-- 
    |-- 
        |-- .
        |-- .
        ...
    |-- 
        |-- .
        |-- .
    |-- train.txt
    |-- test.txt
|-- 
|-- ...
```


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

5. FLOPs & Parameters.

PYTHONPATH="$(dirname $0)/..":$PYTHONPATH python benchmark.py --config local_configs.NYUDepthv2.DFormer_Large

6. Latency.

PYTHONPATH="$(dirname $0)/..":$PYTHONPATH python utils/latency.py --config local_configs.NYUDepthv2.DFormer_Large

ps: The latency highly depends on the devices. It is recommended to compare the latency on the same devices.

🚩 Performance


🕙 ToDo

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.