Giter VIP home page Giter VIP logo

dat-segmentation's Introduction

Vision Transformer with Deformable Attention

This repository contains the code of semantic segmentation for the paper Vision Transformer with Deformable Attention [arXiv], and DAT++: Spatially Dynamic Vision Transformerwith Deformable Attention (extended version)[arXiv].

This code is based on mmsegmentation and Swin Segmentation. To get started, you can follow the instructions in Swin Transformer.

Other links:

Dependencies

In addition to the dependencies of the classification codebase, the following packages are required:

  • mmcv-full == 1.4.0
  • mmsegmentation == 0.29.0

Evaluating Pretrained Models

SemanticFPN

Backbone Schedule mIoU mIoU+MS config pretrained weights
DAT-T++ 80K 48.4 48.8 config OneDrive / TsinghuaCloud
DAT-S++ 80K 49.9 50.7 config OneDrive / TsinghuaCloud
DAT-B++ 80K 50.4 51.1 config OneDrive / TsinghuaCloud

UperNet

Backbone Schedule mIoU mIoU+MS config pretrained weights
DAT-T++ 160K 49.4 50.3 config OneDrive / TsinghuaCloud
DAT-S++ 160K 50.5 51.2 config OneDrive / TsinghuaCloud
DAT-B++ 160K 51.0 51.5 config OneDrive / TsinghuaCloud

To evaluate a pretrained checkpoint, please download the pretrain weights to your local machine and run the mmsegmentation test scripts as follows:

# single-gpu testing
python tools/test.py <CONFIG_FILE> <SEG_CHECKPOINT_FILE> --eval mIoU

# multi-gpu testing
bash tools/dist_test.sh <CONFIG_FILE> <SEG_CHECKPOINT_FILE> <GPU_NUM> --eval mIoU

# multi-gpu, MS testing
bash tools/dist_test.sh <CONFIG_FILE> <SEG_CHECKPOINT_FILE> <GPU_NUM> --aug-test --eval mIoU

Please notice: Before training or evaluation, please set the data_root variable in configs/_base_/datasets/ade20k.py to the path where ADE20K data stores.

Since evaluating models needs no pretrain weights, you can set the pretrained = None in <CONFIG_FILE>.

Training

To train a segmentor with pre-trained models, run:

# single-gpu training
python tools/train.py <CONFIG_FILE>

# multi-gpu training
bash tools/dist_train.sh <CONFIG_FILE> <GPU_NUM> 

Please notice: Make sure the pretrained variable in <CONFIG_FILE> is correctly set to the path of pretrained DAT model.

Acknowledgements

This code is developed on the top of Swin Transformer, we thank to their efficient and neat codebase. The computational resources supporting this work are provided by Hangzhou High-Flyer AI Fundamental Research Co.,Ltd.

Citation

If you find our work is useful in your research, please consider citing:

@article{xia2023dat,
    title={DAT++: Spatially Dynamic Vision Transformer with Deformable Attention}, 
    author={Zhuofan Xia and Xuran Pan and Shiji Song and Li Erran Li and Gao Huang},
    year={2023},
    journal={arXiv preprint arXiv:2309.01430},
}

@InProceedings{Xia_2022_CVPR,
    author    = {Xia, Zhuofan and Pan, Xuran and Song, Shiji and Li, Li Erran and Huang, Gao},
    title     = {Vision Transformer With Deformable Attention},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
    month     = {June},
    year      = {2022},
    pages     = {4794-4803}
}

Contact

If you have any questions or concerns, please send email to [email protected].

dat-segmentation's People

Contributors

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