Abstract
Recently, Transformers have shown promising performance in various vision tasks. A challenging issue in Transformer design is that global self-attention is very expensive to compute, especially for high-resolution vision tasks. Local self-attention improves efficiency by computing within a local region, but its receptive field in a single layer is often insufficient for context modeling. Observing that humans focus on a local region while attending to the periphery at coarse granularity, we develop the Axially Expanded Window (AEWin) self-attention mechanism. AEWin performs fine-grained self-attention within a local window and coarse-grained self-attention along horizontal and vertical axes, effectively capturing both short- and long-range visual dependencies.
Introduction
Vision Transformers (ViTs) have revolutionized computer vision, yet they face a fundamental "Goldilocks" problem regarding attention mechanisms. Global Attention captures long-range dependencies but scales quadratically ($O(N^2)$) with image resolution, making it prohibitively expensive for high-resolution images. Conversely, Local Window Attention (e.g., Swin) is highly efficient but restricts a token's view to a small neighborhood, requiring many stacked layers to achieve a global receptive field.
Furthermore, vanilla ViTs often lack the inductive biases inherent in CNNs, typically requiring massive datasets to perform well. The AEWin Transformer aims to find a better trade-off: a mechanism that captures global context efficiently without sacrificing local precision or requiring hundreds of millions of images for training.
Methods: Axially Expanded Windows (AEWin)
The core innovation is the Axially Expanded Windows (AEWin) Self-Attention. Instead of applying a single type of attention across all heads, AEWin splits multi-head attention into three parallel groups:
- Local Window Group: Performs fine-grained attention within a standard $M \times M$ local window.
- Horizontal Axial Group: Performs coarse-grained attention across a horizontal stripe.
- Vertical Axial Group: Performs coarse-grained attention across a vertical stripe.
Multi-Granularity and Parallelism
To maintain computational efficiency, axial tokens are processed at a coarser granularity (shorter token lengths) than local window tokens. This mimics the human eye, which sees the center of focus clearly but perceives the periphery more vaguely. Unlike previous methods that might apply axial and window attention sequentially, AEWin executes them simultaneously, reducing computational complexity and memory burden.
Additionally, AEWin utilizes a "shifted window" strategy to facilitate information flow between adjacent windows. Because the axial attention already bridges long distances, the authors avoid the complex masking operations required by the Swin Transformer, simplifying the overall implementation.
Experimental Results
The authors evaluated AEWin across a diverse range of benchmarks, demonstrating its effectiveness and efficiency.
Classification and Detection Performance
On ImageNet-1K, AEWin-T (Tiny, 22M params) achieved 83.1% Top-1 accuracy, outperforming Swin-T (81.3%) and CSWin-T (82.7%). For object detection on COCO, AEWin-T reached 47.3 box mAP, a significant jump over Swin-T (43.7). These results were achieved with lower FLOPs than many competitors (e.g., 4.0G for AEWin-T vs 4.5G for Swin-T).
Data Efficiency
AEWin demonstrates superior robustness when training data is limited. On Caltech-256, AEWin-T achieved 48.6% accuracy, nearly 1% higher than CSWin and 5% higher than Swin. This suggests that the axial-local structure provides a better inductive bias than standard window-based attention.
Conclusion
The AEWin Transformer introduces a novel attention mechanism that mimics human vision by combining fine-grained local focus with coarse-grained axial context. By processing these scales in parallel, it achieves state-of-the-art performance on vision tasks while maintaining high computational and data efficiency. While the 3-way parallel split requires careful engineering for hardware optimization, its ability to capture global dependencies in a single layer makes it a powerful architecture for high-resolution vision tasks.
Summary updated