Giter Club home page Giter Club logo

dformer's Introduction

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 ([email protected]). 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

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

  • 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 ([email protected]) 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.

dformer's People

Contributors

yinbow avatar caojiaolong avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.