EfficientFormer: Vision Transformers at MobileNet Speed
arXiv:2206.01191
Abstract
Vision Transformers (ViT) have shown rapid progress in computer vision tasks, achieving promising results on various benchmarks. However, due to the massive number of parameters and model design, \textit{e.g.}, attention mechanism, ViT-based models are generally times slower than lightweight convolutional networks. Therefore, the deployment of ViT for real-time applications is particularly challenging, especially on resource-constrained hardware such as mobile devices. Recent efforts try to reduce the computation complexity of ViT through network architecture search or hybrid design with MobileNet block, yet the inference speed is still unsatisfactory. This leads to an important question: can transformers run as fast as MobileNet while obtaining high performance? To answer this, we first revisit the network architecture and operators used in ViT-based models and identify inefficient designs. Then we introduce a dimension-consistent pure transformer (without MobileNet blocks) as a design paradigm. Finally, we perform latency-driven slimming to get a series of final models dubbed EfficientFormer. Extensive experiments show the superiority of EfficientFormer in performance and speed on mobile devices. Our fastest model, EfficientFormer-L1, achieves top-1 accuracy on ImageNet-1K with only ms inference latency on iPhone 12 (compiled with CoreML), which runs as fast as MobileNetV2 ( ms, top-1), and our largest model, EfficientFormer-L7, obtains accuracy with only ms latency. Our work proves that properly designed transformers can reach extremely low latency on mobile devices while maintaining high performance.
Cited by in corpus (5)
- Exploring the Synergies of Hybrid CNNs and ViTs Architectures for Computer Vision: A survey
- PSLT: A Light-weight Vision Transformer with Ladder Self-Attention and Progressive Shift
- Spatial Gated Multi-Layer Perceptron for Land Use and Land Cover Mapping
- SparX: A Sparse Cross-Layer Connection Mechanism for Hierarchical Vision Mamba and Transformer Networks
- SNP: Structured Neuron-level Pruning to Preserve Attention Scores