# Attention Mechanisms in Computer Vision: A Survey

Survey sorts computer vision attention methods by the operation they perform

Meng-Hao Guo, Tian-Xing Xu, Jiang-Jiang Liu, Zheng-Ning Liu, Peng-Tao Jiang, Tai-Jiang Mu and 4 more · arXiv · 2021-11-15

- **Problem** Attention methods in vision are usually grouped by task, so a reader cannot see which design choices carry across tasks. Earlier surveys also covered only parts of the field, such as RNN-based attention.
- **Method** The authors sort attention methods by the data domain each one weights. Four basic groups are channel, spatial, temporal and branch attention, plus two hybrids that combine them.
- **Results** The survey sorts existing methods into six categories, four basic and two hybrid. Empty cells in the grid mark combinations that no method has yet reported.

## Why application-based grouping hides the design choices

Attention is, in this survey's framing, a way of weighting features by how much they matter for the input. Such methods now appear in image classification, object detection, semantic segmentation, video understanding and more. The field has also moved quickly, and the authors split its history into four loose phases, from recurrent models to self-attention.

Because the same idea returns in different tasks, a list organised by task makes it hard to see which design choices carry over.

Earlier surveys mostly organised the topic around the fields where the methods were applied. One covers attention in deep networks for natural language processing, and others focus on visual transformers only. The survey by Wang et al. covers only RNN-based attention in vision, which is one part of the picture. So a reader looking for a channel reweighting module has to search across tasks, and the operation the module shares with others stays hidden.

## Attention as a weighting step over features

The key idea is that most attention methods share one structure: a signal is computed from the input, and that signal reweights the input. The survey writes this as \\( Attention = f(g(x), x) \\), where g(x) produces the attention signal and f combines it with the input x. The g(x) part is meant to find the discriminative regions, which is the role attention plays in human vision.

The authors argue this form is necessary but not sufficient, because GoogleNet fits the formula without being an attention mechanism.

In many of the surveyed modules the output is \\( Y = sX \\), where s is a mask and X is the input feature map. Table 1 defines X as an input feature map of size C by H by W, and Y as the output feature map. A soft attention weight can be read as the relative importance of a location, while a hard attention weight can be read as the probability that the location is the right one to focus on.

## Four basic categories and two hybrids

The survey sorts existing methods into six groups, and the sorting follows the data domain each method acts on. Four groups are basic: channel attention asks what to attend to, spatial attention asks where, temporal attention asks when, and branch attention asks which branch. Channel, spatial and temporal attention act on different axes of a feature, while branch attention is complementary to them and works across parallel branches.

The two hybrids combine channel with spatial attention, or spatial with temporal attention.

This domain-based sorting is the paper's main contribution, since it ties a method to its operation rather than to the task where it was tested. The authors also mark the combinations that don't yet exist, so the empty cells show where no method has been reported. Under this scheme SENet is read as a channel method whether it is used for classification or for detection.

## How spatial attention chooses regions

RAM takes a different route, reaching regions through a sequence of glimpses rather than through one weight map. The glimpse sensor takes a coordinate and the image, then returns patches centred on that coordinate. An RNN combines the glimpse feature with its internal state, then outputs the next coordinate and an action. Choosing the next coordinate is not differentiable, so RAM is updated with reinforcement learning rather than ordinary backpropagation.

STN takes a more direct route, predicting an affine transformation with a sub-network so the network samples the most relevant regions. Deformable ConvNets go further and learn offsets, so the sampling grid moves with the input. Because those offsets are fractional, bilinear interpolation is used to sample the feature map at them.

Self-attention works differently, with each position weighing every other position through queries, keys and values. The attention matrix is N by N, so the cost grows quadratically with the number of positions.

## Temporal and branch attention

GLTR pairs a dilated temporal pyramid for short-range context with a self-attention module for global temporal interaction. Its self-attention has quadratic time complexity, which limits where it can be applied. TAM replaces self-attention with an adaptive kernel for its global branch, while a local branch uses 1D convolutions. The authors report that TAM has lower time complexity than GLTR.

Branch attention starts from the highway network, which uses a learned gate to mix a transformed signal with a skip path. SKNet builds branches with different kernel sizes, fuses them by element-wise summation, and uses a gate vector to select among them. CondConv instead combines several convolution kernels, which raises capacity without the extra cost of a deeper or wider network.

## Combining channel and spatial weights

DANet runs a position attention module and a channel attention module in parallel, then sums their outputs. The position branch uses a softmax over query-key similarities, while the channel branch works on the similarity of the features themselves. This captures long-range context well, but it is costly for large feature maps.

Coordinate attention pools along each axis separately, so the two resulting weights keep positional information. SimAM takes the opposite route with no learned parameters, computing an energy for each neuron. It applies a sigmoid to one over the energy and multiplies the input by the result.

## Open problems

The authors couldn't find a necessary and sufficient condition for all attention mechanisms. They propose a general attention block that could choose channel, spatial or temporal weights per task, since each task now needs its own design. Interpretability is another gap, because attention maps give an intuitive feel rather than a precise account of what the model does.

Visualised attention maps from ViT show sparse activation, and the authors suggest that sparsity may help performance. Attention models often need optimisers other than SGD and Adam, and deploying them on edge devices is harder than deploying CNNs. The survey reports no new experiments, so its claims rest on the works it cites.

## Paper info

- **Authors**: Meng-Hao Guo, Tian-Xing Xu, Jiang-Jiang Liu, Zheng-Ning Liu, Peng-Tao Jiang, Tai-Jiang Mu, Song-Hai Zhang, Ralph R. Martin, Ming-Ming Cheng, Shi-Min Hu
- **Venue**: arXiv · Preprint
- **First published**: 2021-11-15
- **Added**: 2026-11-12
- **Updated**: 2021-11-15
- **Version**: v1
- **arXiv**: 2111.07624
- **DOI**: 10.1007/s41095-022-0271-y
- **Category**: cs.CV
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/2111.07624v1) · [PDF ↗](https://arxiv.org/pdf/2111.07624v1)

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

Meng-Hao Guo, Tian-Xing Xu, Jiang-Jiang Liu, Zheng-Ning Liu, Peng-Tao Jiang, Tai-Jiang Mu, Song-Hai Zhang, Ralph R. Martin, Ming-Ming Cheng, Shi-Min Hu (2021). Attention Mechanisms in Computer Vision: A Survey. arXiv:2111.07624v1. https://doi.org/10.1007/s41095-022-0271-y

**BibTeX**

```
@article{guo2021attention,
  title = {{Attention Mechanisms in Computer Vision: A Survey}},
  author = {Meng-Hao Guo and Tian-Xing Xu and Jiang-Jiang Liu and Zheng-Ning Liu and Peng-Tao Jiang and Tai-Jiang Mu and Song-Hai Zhang and Ralph R. Martin and Ming-Ming Cheng and Shi-Min Hu},
  year = {2021},
  eprint = {2111.07624},
  archivePrefix = {arXiv},
  doi = {10.1007/s41095-022-0271-y},
  url = {https://arxiv.org/abs/2111.07624v1}
}
```

## Related papers

- [Coordinate Attention for Efficient Mobile Network Design](https://refivu.com/en/papers/dfcb6641-7770-48f4-826a-22a20dca2f0b-coordinate-attention-for-efficient-mobile-network-design.md)
- [Attention Gated Networks: Learning to Leverage Salient Regions in Medical Images](https://refivu.com/en/papers/63b212b7-3fc0-42f4-b6d8-1724e918c784-attention-gated-networks-learning-to-leverage-salient.md)
- [Effective Approaches to Attention-based Neural Machine Translation](https://refivu.com/en/papers/58ab56a7-1cd5-4c5e-be62-69ff9c1387c7-effective-approaches-to-attention-based-neural-machine.md)
- [RMPE: Regional Multi-person Pose Estimation](https://refivu.com/en/papers/a258675a-c286-4c65-9760-3d72305d7120-rmpe-regional-multi-person-pose-estimation.md)
- [The Arcade Learning Environment: An Evaluation Platform for General Agents](https://refivu.com/en/papers/2c89eed5-9dfb-4243-8466-0655582e3266-the-arcade-learning-environment-an-evaluation-platform-for.md)
- [Attention U-Net: Learning Where to Look for the Pancreas](https://refivu.com/en/papers/b480e08e-027d-4c11-b1c5-0d3a4a63ead9-attention-u-net-learning-where-to-look-for.md)

## Other paper commentary

- [Frustum PointNets for 3D Object Detection from RGB-D Data](https://refivu.com/en/papers/3af69443-6a48-4c1c-81f3-e2c87f8df280-frustum-pointnets-for-3d-object-detection-from-rgb.md)
- [LLaVA-OneVision: Easy Visual Task Transfer](https://refivu.com/en/papers/65c8f703-40f9-4b42-9b35-ea00d5929366-llava-onevision-easy-visual-task-transfer.md)
- [Zero-Reference Deep Curve Estimation for Low-Light Image Enhancement](https://refivu.com/en/papers/674a173b-b03f-4f14-89ec-10bec15a7629-zero-reference-deep-curve-estimation-for-low-light.md)
- [BEiT: BERT Pre-Training of Image Transformers](https://refivu.com/en/papers/de9cda9f-90f4-48cc-9bb3-e6f03f9683c7-beit-bert-pre-training-of-image-transformers.md)
- [Training Region-based Object Detectors with Online Hard Example Mining](https://refivu.com/en/papers/3c16d5fe-9eb6-4481-9b4d-f4eefd0171ee-training-region-based-object-detectors-with-online-hard.md)
- [Unsupervised Learning of Visual Features by Contrasting Cluster Assignments](https://refivu.com/en/papers/8f949bbf-9733-4844-b3ee-a88f5313c480-unsupervised-learning-of-visual-features-by-contrasting.md)
- [Offline Reinforcement Learning: Tutorial, Review, and Perspectives on Open Problems](https://refivu.com/en/papers/c66662c6-5085-45ec-9290-15bb160cbde0-offline-reinforcement-learning-tutorial-review-and.md)
- [Generative Adversarial Text to Image Synthesis](https://refivu.com/en/papers/e3b168a4-0572-44b9-b18e-ca2f31dfdc4a-generative-adversarial-text-to-image-synthesis.md)
- [European Union regulations on algorithmic decision-making and a "right to explanation"](https://refivu.com/en/papers/8d7d2fe1-f155-44ca-8f0a-551e154b6b3a-european-union-regulations-on-algorithmic-decision-making.md)
- [Don't Stop Pretraining: Adapt Language Models to Domains and Tasks](https://refivu.com/en/papers/0864e409-68d0-4d61-98fd-5ab02360285a-don-t-stop-pretraining-adapt-language-models-to.md)

## Terms in this paper

- [reinforcement learning](https://refivu.com/en/terms/6c51042515d2-reinforcement-learning)
- [self-attention](https://refivu.com/en/terms/426589b81077-self-attention)
- [attention mechanism](https://refivu.com/en/terms/977ee0201459-attention-mechanism)
- [global average pooling](https://refivu.com/en/terms/f70116a971b4-global-average-pooling)
- [attention mechanisms](https://refivu.com/en/terms/d53b74377603-attention-mechanisms)
- [channel attention](https://refivu.com/en/terms/653ad7339ce9-channel-attention)
- [spatial attention](https://refivu.com/en/terms/39f68fa6649a-spatial-attention)
- [highway network](https://refivu.com/en/terms/5d467b0ea7c9-highway-network)
- [SENet](https://refivu.com/en/terms/dbc736b76740-senet)
- [attention gate](https://refivu.com/en/terms/8ad827a9cb9b-attention-gate)
- [deformable ConvNets](https://refivu.com/en/terms/4e3127272a7a-deformable-convnets)
- [GLTR](https://refivu.com/en/terms/57e5313622ae-gltr)
- [RAM](https://refivu.com/en/terms/bc98efbd251c-ram)
- [temporal attention](https://refivu.com/en/terms/20aef5b6bb62-temporal-attention)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/d03d817b-607b-4760-8cb5-139501ae5964-attention-mechanisms-in-computer-vision-a-survey)
