MCPcopy Index your code
hub / github.com/CASIA-IVA-Lab/DANet

github.com/CASIA-IVA-Lab/DANet @v1.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.0 ↗ · + Follow
671 symbols 1,840 edges 109 files 140 documented · 21%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Dual Attention Network for Scene Segmentation(CVPR2019)

Jun Fu, Jing Liu, Haijie Tian, Yong Li, Yongjun Bao, Zhiwei Fang,and Hanqing Lu

Introduction

We propose a Dual Attention Network (DANet) to adaptively integrate local features with their global dependencies based on the self-attention mechanism. And we achieve new state-of-the-art segmentation performance on three challenging scene segmentation datasets, i.e., Cityscapes, PASCAL Context and COCO Stuff-10k dataset.

image

Cityscapes testing set result

We train our DANet-101 with only fine annotated data and submit our test results to the official evaluation server.

image

Updates

2020/9Renew the code, which supports Pytorch 1.4.0 or later.

2020/8:The new TNNLS version DRANet achieves 82.9% on Cityscapes test set, which a new state-of-the-arts performance with only fine annotated dataset. The code will be released in DRANet.

2020/7:DANet is supported on MMSegmentation, in which DANet achieves 80.47% with single scale testing and 82.02% with multi-scale testing on Cityscapes val set.

2018/9:DANet released. The trained model with ResNet101 achieves 81.5% on Cityscapes test set.

Usage

  1. Install pytorch

  2. The code is tested on python3.6 and torch 1.4.0.

  3. The code is modified from PyTorch-Encoding.

  4. Clone the resposity

shell git clone https://github.com/junfu1115/DANet.git cd DANet python setup.py install

  1. Dataset
  2. Download the Cityscapes dataset and convert the dataset to 19 categories.
  3. Please put dataset in folder ./datasets

  4. Evaluation for DANet

  5. Download trained model DANet101 and put it in folder ./experiments/segmentation/models/

  6. cd ./experiments/segmentation/

  7. For single scale testing, please run:

  8. shell CUDA_VISIBLE_DEVICES=4,5,6,7 python test.py --dataset citys --model danet --backbone resnet101 --resume models/DANet101.pth.tar --eval --base-size 2048 --crop-size 768 --workers 1 --multi-grid --multi-dilation 4 8 16 --os 8 --aux --no-deepstem

  9. Evaluation Result

    The expected scores will show as follows: DANet101 on cityscapes val set (mIoU/pAcc): 79.93/95.97(ss)

  10. Evaluation for DRANet

  11. Download trained model DRANet101 and put it in folder ./experiments/segmentation/models/

  12. Evaluation code is in folder ./experiments/segmentation/

  13. cd ./experiments/segmentation/

  14. For single scale testing, please run:

  15. shell CUDA_VISIBLE_DEVICES=4,5,6,7 python test.py --dataset citys --model dran --backbone resnet101 --resume  models/dran101.pth.tar --eval --base-size 2048 --crop-size 768 --workers 1 --multi-grid --multi-dilation 4 8 16 --os 8 --aux

  16. Evaluation Result

    The expected scores will show as follows: DRANet101 on cityscapes val set (mIoU/pAcc): 81.63/96.62 (ss)

Citation

if you find DANet and DRANet useful in your research, please consider citing:

@article{fu2020scene,
  title={Scene Segmentation With Dual Relation-Aware Attention Network},
  author={Fu, Jun and Liu, Jing and Jiang, Jie and Li, Yong and Bao, Yongjun and Lu, Hanqing},
  journal={IEEE Transactions on Neural Networks and Learning Systems},
  year={2020},
  publisher={IEEE}
}
@inproceedings{fu2019dual,
  title={Dual attention network for scene segmentation},
  author={Fu, Jun and Liu, Jing and Tian, Haijie and Li, Yong and Bao, Yongjun and Fang, Zhiwei and Lu, Hanqing},
  booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
  pages={3146--3154},
  year={2019}
}

Acknowledgement

Thanks PyTorch-Encoding, especially the Synchronized BN!

Core symbols most depended-on inside this repo

get_model_file
called by 28
encoding/models/model_store.py
mkdir
called by 15
encoding/utils/files.py
get
called by 13
encoding/utils/metrics.py
warpSum
called by 10
encoding/lib/gpu/common.h
base_forward
called by 10
encoding/models/sseg/base.py
gather
called by 9
encoding/parallel.py
update
called by 9
encoding/utils/misc.py
_make_layer
called by 9
encoding/models/backbone/resnet.py

Shape

Method 321
Function 229
Class 121

Languages

Python91%
C++8%
TypeScript1%

Modules by API surface

encoding/nn/encoding.py26 symbols
encoding/nn/customize.py25 symbols
encoding/transforms/autoaug.py24 symbols
encoding/models/sseg/deeplab.py23 symbols
encoding/models/sseg/fcn.py17 symbols
encoding/models/sseg/encnet.py16 symbols
encoding/models/backbone/xception.py16 symbols
encoding/lib/gpu/device_tensor.h15 symbols
encoding/parallel.py14 symbols
encoding/nn/syncbn.py14 symbols
encoding/models/sseg/base.py14 symbols
encoding/utils/metrics.py13 symbols

For agents

$ claude mcp add DANet \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page