TL;DR
This paper introduces SeaFormer++, a novel Transformer architecture designed for efficient visual recognition on mobile devices. By introducing a "squeeze-enhanced Axial attention" mechanism and a multi-resolution distillation technique, SeaFormer++ achieves state-of-the-art performance in semantic segmentation with significantly lower latency and computational cost compared to existing Transformer and CNN-based models, making it suitable for resource-constrained environments.
What Problem Does This Paper Address?
The advent of Vision Transformers (ViTs) has revolutionized computer vision, outperforming traditional Convolutional Neural Networks (CNNs) in many tasks like semantic segmentation. However, the computational demands and memory requirements of standard ViTs make them impractical for deployment on mobile devices. While various efficient Transformer variants and lightweight CNNs exist, they often struggle to strike an optimal balance between accuracy and latency, especially for high-resolution image processing. This paper aims to bridge this gap by developing a Transformer architecture specifically tailored for mobile visual recognition, offering superior efficiency without sacrificing performance.
Methods
The core innovation is the squeeze-enhanced Axial attention (SEA attention) module. This module addresses the quadratic complexity of standard self-attention by:
- Squeeze Axial: It reduces the spatial dimensions of query, key, and value tensors by pooling along the height and width axes, effectively creating compact representations of global information.
- Detail Enhancement: A lightweight, depth-wise convolution-based kernel is then applied to re-introduce local details that might be lost during the squeezing process.
- Adaptive Squeeze/Expand: Unlike fixed pooling, SEA attention uses adaptive masks to map tokens, making it input-dependent and more robust.
The SEA attention module is integrated into a two-branch architecture:
- Context Branch: Captures high-level semantic information using stacked SeaFormer layers.
- Spatial Branch: Processes high-resolution features to preserve spatial details. A fusion block combines features from both branches.
To further reduce inference latency, the authors propose a multi-resolution distillation technique. This method uses a high-resolution teacher model to guide a lower-resolution student model, aligning features at different stages through upsampling and a similarity loss, enabling efficient knowledge transfer.
Datasets
The paper uses standard datasets for its evaluations:
- ADE20K: For semantic segmentation.
- Cityscapes: For semantic segmentation.
- Pascal Context: For semantic segmentation.
- COCO-Stuff: For semantic segmentation.
- ImageNet-1K: For image classification.
- COCO dataset: For object detection.
Key Insights and Ideas
- Squeeze-and-Excite meets Axial Attention: The SEA attention module cleverly combines the efficiency of axial attention with a squeeze-like mechanism to capture global context while retaining local detail through a dedicated enhancement kernel. This is a novel way to make Transformers more efficient.
- Adaptive Operations are Key: Using adaptive masks for squeezing and expanding, rather than fixed pooling, allows the model to better adapt to input features, leading to improved performance.
- Distillation for Latency Reduction: Multi-resolution distillation, specifically with feature upsampling, is shown to be a powerful technique for reducing inference latency on mobile devices without significant accuracy degradation.
- Versatility Beyond Segmentation: The SeaFormer architecture demonstrates strong performance not only in semantic segmentation but also in image classification and object detection, highlighting its potential as a general-purpose mobile-friendly backbone.
Key Results
- Semantic Segmentation: SeaFormer++ achieves state-of-the-art performance on ADE20K, Cityscapes, Pascal Context, and COCO-Stuff datasets, outperforming both mobile-friendly CNNs and other Transformer-based models in terms of accuracy and latency. For example, on ADE20K, SeaFormer-B++ achieves 41.4 mIoU with significantly lower latency (107ms) compared to TopFormer-B (39.2 mIoU, 112ms).
- Efficiency: The proposed SEA attention reduces the complexity of axial attention to O(HW), making it highly efficient. The multi-resolution distillation further reduces latency, with SeaFormer++(KD) achieving 42.2 mIoU on ADE20K with only 2.9G FLOPs and 177ms latency.
- Image Classification: SeaFormer++ demonstrates a competitive trade-off between latency and accuracy on ImageNet-1K, outperforming many existing efficient models.
- Object Detection: When used as a backbone for object detection on COCO, SeaFormer++ shows superior results, further validating its generalization capabilities.
Limitations and Future Work
- Computational Cost of High-Resolution: While SeaFormer is designed for mobile, processing very high-resolution images can still be computationally intensive. The paper mentions that the shared STEM takes up a significant portion of the latency for smaller models.
- Further Optimization: The authors suggest that further exploration of distillation techniques and architectural optimizations could lead to even greater efficiency gains.
- Broader Applications: While demonstrated on classification and detection, exploring SeaFormer's potential in other vision tasks like video analysis or generative models could be a future direction.
- Hardware-Specific Optimizations: The current latency measurements are on a specific ARM CPU. Further optimization for diverse mobile hardware platforms could be beneficial.
Summary updated