Introduction
Convolutional Neural Networks (CNNs) have long been the standard for computer vision tasks. Their success stems from their ability to exploit local spatial correlations through translation-invariant filters. However, the convolution operator is inherently limited by its local receptive field. To capture long-range dependencies and global context, CNNs must stack numerous layers, which can be inefficient and may fail to capture complex global relationships.
In contrast, self-attention mechanisms—most notably the Transformer architecture—have revolutionized natural language processing by enabling models to capture long-range interactions regardless of distance. This paper introduces Attention Augmented Convolution, a novel approach that integrates self-attention directly into the convolutional pipeline. By concatenating standard convolutional feature maps with those generated by a 2D relative self-attention mechanism, the authors create a hybrid architecture that leverages the strengths of both local and global feature extraction.
The Attention Augmented Convolution Block
The core contribution of this work is the Attention Augmented Convolutional layer. Unlike previous methods like Squeeze-and-Excitation (SE), which merely reweight existing convolutional channels, this method generates entirely new feature maps using self-attention.
2D Relative Self-Attention
Standard self-attention is permutation equivariant, meaning it does not inherently account for the spatial arrangement of pixels. For vision tasks, spatial structure is critical. To address this, the authors introduce a 2D relative positional encoding. This mechanism injects relative height and width information into the attention calculation, ensuring the operation remains translation equivariant—a property that allows the model to recognize patterns regardless of their position in the image.
Augmentation via Concatenation
The architecture processes input through two parallel paths:
- Standard Convolution: A traditional convolutional layer that extracts local features.
- Multi-head Self-Attention: A self-attention mechanism that captures global context.
The outputs from these two paths are concatenated along the channel dimension. This allows the network to maintain the strong local inductive bias of convolutions while simultaneously benefiting from the global receptive field of self-attention. To manage the quadratic memory cost ($O((HW)^2)$) associated with self-attention, the authors typically apply this augmentation in later stages of the network or use average pooling to downsample the inputs to the attention mechanism.
Experimental Evaluation
The authors evaluated Attention Augmented (AA) networks across several benchmarks, demonstrating consistent improvements over baseline CNN architectures.
ImageNet Classification
On the ImageNet dataset, an AA-ResNet-50 achieved a top-1 accuracy of 77.7%, representing a +1.3% improvement over the standard ResNet-50 (76.4%) with a comparable parameter count. Notably, it also outperformed SE-ResNet-50 (77.5%), suggesting that generating new features is more effective than simply recalibrating existing ones.
COCO Object Detection
The benefits of attention augmentation were even more pronounced in object detection. Using an AA-ResNet-50 backbone within the RetinaNet framework resulted in a +1.4 mAP improvement (38.2 vs 36.8). Interestingly, adding Squeeze-and-Excitation to RetinaNet actually decreased performance, likely because SE's global pooling discards the precise spatial localization information required for detection—information that the AA mechanism preserves.
Mobile Architectures
The method also proved effective for resource-constrained models. When applied to MnasNet, attention augmentation provided a consistent boost (e.g., from 75.2% to 75.7% top-1 accuracy) with only a marginal increase in computational overhead.
Discussion: Is Convolution Necessary?
In a significant ablation study, the authors explored "fully attentional" models by replacing all 3x3 spatial convolutions in a ResNet-50 with attention layers. This model achieved surprisingly high performance, trailing the standard ResNet-50 by only 2.5% despite having 25% fewer parameters. This finding suggests that self-attention is a viable standalone primitive for vision, though the hybrid approach currently offers the best performance-to-efficiency trade-off.
Conclusion
Attention Augmented Convolution provides a systematic way to enhance CNNs with global context. By combining the local efficiency of convolutions with the long-range modeling capabilities of self-attention, this approach achieves state-of-the-art results across classification and detection tasks. While the quadratic scaling of self-attention remains a challenge for high-resolution images, this work paves the way for future architectures that may eventually move beyond the convolution-only paradigm.
Summary updated