Paper commentary
Dual Attention Network for Scene Segmentation
Dual attention lets a network model global context for scene segmentation
- Problem Multi-scale fusion adds context but cannot model how objects and stuff relate across a whole image. Recurrent models capture long-range links only implicitly, through memory that may not keep the information.
- Method DANet adds parallel position and channel self-attention modules to a dilated FCN.
- Results DANet-101 scores 81.5% Mean IoU on the Cityscapes test set using only fine annotations. The paper reports new state-of-the-art results on three scene segmentation datasets.
Why local features fall short for scene parsing
Scene segmentation labels every pixel, covering stuff such as sky and road as well as objects such as car and person. Confusable classes such as field and grass, and objects that change in scale, occlusion or lighting, make local evidence unreliable. Most FCN methods respond with multi-scale context fusion, using dilated convolutions, pooling or encoder-decoder structures.
Fusion helps with objects at different scales, but it can't model how objects and stuff relate across the whole image.
Recurrent networks such as 2D LSTMs and DAG-RNN try to capture long-range dependencies instead. They do this implicitly, so the result depends on how well the recurrent memory learns to keep long-range information. That leaves open how to model global relations explicitly, inside the network, for both positions and channels.
A dual attention design for global context
The key idea is to rewrite each feature as a weighted mix of all positions, and each channel map as a weighted mix of all channel maps. The weights come from feature similarity, so DANet places two such self-attention branches in parallel on top of a dilated FCN. The outputs of the position branch and the channel branch are then fused to refine the features.
The authors expect this to work because similar features should help each other whatever their distance in the image. Under this view, a car pixel can draw on a distant car pixel directly, without passing through the pixels between them. The authors also argue that a salient object shouldn't drown out a less visible one, because attention picks out similar features.
This matters for scale too, since features of the same class at different sizes are pulled together by similarity rather than by distance. The design therefore targets objects that are small, partly hidden or inconspicuous in the scene.
How the position attention module mixes features
The backbone is a residual network that uses dilation, with its last two blocks changed to keep more spatial resolution. The final feature map is 1/8 of the input size, which keeps more detail without adding parameters. A convolution first reduces the dimension of these features before they enter the attention modules.
Given a local feature \(A\in\mathbb{R}^{C\times H\times W}\), two convolutions produce \(B\) and \(C\), reshaped to \(C\times N\) with \(N=H\times W\). A matrix product of the transpose of \(C\) with \(B\), followed by a softmax, gives the spatial attention map \(S\in\mathbb{R}^{N\times N}\). Each entry is \(s_{ji}=\frac{\exp(B_i\cdot C_j)}{\sum_{i=1}^{N}\exp(B_i\cdot C_j)}\), so the softmax runs over all positions \(i\) for each fixed \(j\), and \(s_{ji}\) measures how much position \(i\) affects position \(j\).
A third convolution produces \(D\), and the output is \(E_j=\alpha\sum_{i=1}^{N}s_{ji}D_i+A_j\). The scale \(\alpha\) starts at 0, so the module first passes \(A\) through unchanged and learns how much global context to add. Each output position is therefore a weighted sum over all positions plus the original feature.
Channel attention and how the branches are fused
The channel branch skips convolution embedding and works on \(A\) directly, which the authors argue keeps the relations between channel maps intact. Reshaping \(A\) to \(C\times N\), multiplying it by its own transpose and applying a softmax gives a \(C\times C\) channel attention map. Each entry is \(x_{ji}=\frac{\exp(A_i\cdot A_j)}{\sum_{i=1}^{C}\exp(A_i\cdot A_j)}\), which measures the impact of channel \(i\) on channel \(j\).
Each channel map is rebuilt as \(E_j=\beta\sum_{i=1}^{C}x_{ji}A_i+A_j\), with \(\beta\) also starting at 0 and then learned. Each output channel is a weighted sum over all channels plus the original features. Unlike a global pooling or encoding layer, this branch uses the spatial information at every corresponding position to model channel correlation.
Both branches end in convolutions, and their transformed outputs are summed element-wise. A last convolution produces the prediction map, and cascading is skipped because it needs more GPU memory. The modules are simple, can be inserted into an existing FCN pipeline, and add few parameters.
Cityscapes ablations show each module's gain
Adding only the position attention module raises this to 75.74%, a gain of 5.71 points.
On both backbones the position module alone beats the channel module alone. So each module helps on its own, and the combination scores higher than either one.
The authors' visual comparisons on Cityscapes validation images suggest the position module sharpens details and boundaries, such as a pole and a sidewalk. The channel module corrects some misclassified categories, such as bus in the first and third rows. These are a few examples, and the table carries the measured gains.
From ablation to a Cityscapes test score
Multi-scale inference, averaging probability maps from eight scales, brings the score to 81.50%.
Because the strategy set is shared, the gap reflects what DANet adds on top of the same training recipe.
On the Cityscapes test set, DANet-101 trained with only fine annotated data scores 81.5% Mean IoU. The test results were submitted to the official evaluation server, and the table lists PSANet at 80.1 with the same ResNet-101 backbone. The margin over PSANet is described as large, and DenseASPP at 80.6 is noted to use more powerful pretrained models.
PASCAL VOC, PASCAL Context and COCO Stuff results
On PASCAL VOC 2012 validation, the dilated FCN with ResNet-50 scores 75.7, while DANet scores 79.0 on ResNet-50 and 80.4 on ResNet-101. The authors note that DANet-50 exceeds the baseline by 3.3%. On the VOC test set, DANet (Res101) scores 82.6, level with PSPNet at 82.6 and below EncNet at 82.9, after fine-tuning on the trainval set.
On PASCAL Context, the Dilated FCN with ResNet-50 scores 44.3%, DANet-50 scores 50.1%, and DANet with ResNet-101 scores 52.6%. The authors credit explicit modeling of global dependencies, and note that some competitors used extra COCO data or a deeper ResNet-152.
The authors contrast their approach with the chain structure of DAG-RNN and with the gating in the decoder used by Ding et al.
Limitations
The authors name reducing computational complexity and improving robustness as open issues for future work.
The Cityscapes test result uses fine annotations only, since the authors don't use coarse data. On the PASCAL VOC 2012 test set, DANet (Res101) at 82.6 doesn't beat EncNet at 82.9. The visual examples cover only a few Cityscapes validation images, so they don't replace measured scores.
Paper info
- Authors
- Jun Fu, Jing Liu, Haijie Tian, Yong Li, Yongjun Bao, Zhiwei Fang, Hanqing Lu
- Venue
- arXiv · Preprint
- First published
- 2018-9-9
- Added
- 2026-11-11
- Updated
- 2019-4-21
- Version
- v4
- arXiv
- 1809.02983
- Category
- cs.CV
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Jun Fu, Jing Liu, Haijie Tian, Yong Li, Yongjun Bao, Zhiwei Fang, Hanqing Lu (2018). Dual Attention Network for Scene Segmentation. arXiv:1809.02983v4. https://arxiv.org/abs/1809.02983v4
BibTeX
@misc{fu2018dual,
title = {{Dual Attention Network for Scene Segmentation}},
author = {Jun Fu and Jing Liu and Haijie Tian and Yong Li and Yongjun Bao and Zhiwei Fang and Hanqing Lu},
year = {2018},
eprint = {1809.02983},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1809.02983v4}
}