TL;DR
This paper introduces FMViT, a novel hybrid Vision Transformer architecture that efficiently blends high and low-frequency features to achieve state-of-the-art accuracy-latency trade-offs across various vision tasks. By incorporating lightweight convolutional blocks and a multi-frequency fusion mechanism, FMViT significantly outperforms existing CNNs, ViTs, and hybrid models on deployment-focused platforms like TensorRT and CoreML.
What Problem Does This Paper Address?
Vision Transformers (ViTs) have shown impressive performance in computer vision tasks, but their quadratic complexity in self-attention makes them computationally expensive for real-world deployment, especially compared to traditional Convolutional Neural Networks (CNNs). While hybrid architectures aim to bridge this gap, their performance-latency trade-offs often fall short of expectations. This paper tackles the challenge of creating efficient and accurate ViT-based models suitable for practical deployment on devices and servers, where inference speed is critical.
Methods
The core of FMViT lies in its innovative architecture and several key components:
- Multi-frequency Fusion Block (FMB): This block is designed to capture and integrate diverse high-frequency and low-frequency features. It aims to enhance the model's information flow and expressive capacity by effectively blending signals from different frequency bands, inspired by techniques in image super-resolution.
- Convolutional Fusion Block (CFB): CFB leverages depthwise separable convolutions (DWConv) as a token mixer, maintaining the efficiency benefits of bottleneck blocks while achieving Transformer-level performance. It effectively combines local modeling capabilities of convolutions with the Transformer paradigm.
- Lightweight Multi-head Self-Attention (RLMHSA): To address the computational burden of standard Multi-head Self-Attention (MHSA), RLMHSA proposes a reparameterized and lightweight design. It achieves parameter sharing and reduces computational complexity, leading to faster inference without significant accuracy degradation.
- Convolutional Multi-group Reparameterization (gMLP): This technique is applied to the MLP layers. During training, multiple convolutions with varying group sizes are used in parallel. During inference, these are fused into a single convolution, improving accuracy without impacting speed. This is also used to enhance the CFB's performance.
FMViT builds upon these components within a conventional pyramidal structure, similar to other efficient ViTs.
Datasets
The paper primarily uses the ImageNet-1K dataset for image classification tasks. It also evaluates FMViT on the COCO2017 dataset for object detection and instance segmentation, and the ADE20K dataset for semantic segmentation.
Key Insights and Ideas
- Frequency Fusion is Key: The paper strongly advocates for the explicit fusion of high and low-frequency features. They argue that while CNNs excel at high frequencies and ViTs at low frequencies, a balanced approach is crucial for robust performance.
- Deployment-Centric Design: A significant focus is placed on optimizing for real-world deployment platforms like TensorRT and CoreML, rather than just theoretical FLOPs. This leads to practical improvements in inference speed.
- Reparameterization for Efficiency: The use of reparameterization techniques (like gMLP for MLPs and structural reparameterization for CFB) during training to simplify the model for inference is a recurring theme, demonstrating its effectiveness in balancing performance and efficiency.
- Lightweight Attention is Viable: The RLMHSA module shows that it's possible to significantly reduce the computational cost of self-attention without sacrificing too much accuracy, making ViTs more practical for resource-constrained environments.
Key Results
FMViT demonstrates impressive results across various tasks:
- Image Classification (ImageNet-1K):
- On TensorRT, FMViT outperforms ResNet101 by 2.5% in top-1 accuracy (83.3% vs. 80.8%) with similar inference latency.
- It achieves comparable performance to EfficientNet-B5 but with a 43% improvement in inference speed.
- On CoreML, FMViT surpasses MobileOne by 2.6% in top-1 accuracy while maintaining comparable inference latency.
- Object Detection and Instance Segmentation (COCO2017):
- FMViT-B achieves a 16% faster inference on TensorRT than ResNet101 while also improving APb by 3.7.
- It matches the inference speed of PoolFormer-S12 on TensorRT but with a 6.8 APb enhancement.
- Semantic Segmentation (ADE20K):
- FMViT-B achieves 4.7 mIoU higher than ResNet101 with consistent inference speed.
- It shows a 0.5 mIoU improvement with 18% and 43% faster inference on TensorRT and CoreML, respectively, compared to Next-ViT-S.
Limitations and Future Work
- Stacked Modules: The authors acknowledge that their provided models are stacked without further scrutiny. They suggest that future work could explore Network Architecture Search (NAS) or other stacking methods to optimize the impact of different module combinations.
- Further Optimization: While RLMHSA reduces parameters and FLOPs, the paper notes a slight decrease in classification performance compared to standard MHSA. Further research could aim to mitigate this.
- Broader Applications: The paper focuses on classification, detection, and segmentation. Exploring FMViT's performance on other vision tasks could be a natural next step.
Summary updated