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, 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 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 79.2% top-1 accuracy on ImageNet-1K with only 1.6 ms inference latency on iPhone 12 (compiled with CoreML), which is even a bit faster than MobileNetV2 (1.7 ms, 71.8% top-1), and our largest model, EfficientFormer-L7, obtains 83.3% accuracy with only 7.0 ms latency. Our work proves that properly designed transformers can reach extremely low latency on mobile devices while maintaining high performance
翻译:视觉变异器(ViT)在计算机愿景任务方面显示出快速进展,在各种基准上取得了令人乐观的成果。然而,由于大量参数和模型设计,例如注意力机制,ViT基模型通常比轻量级变速网络慢一倍。因此,为实时应用部署ViT特别具有挑战性,特别是在诸如移动设备等资源受限制的硬件方面。最近的努力试图通过网络结构搜索或与移动网络块的混合设计来降低ViT的计算复杂性,但推力速度仍然不尽如人意。这导致一个重要问题:变异器能否在获得高性能的同时与移动网络一样快速运行?为了回答这个问题,我们首先重新审查ViT基模型中使用的网络架构和操作员和操作员,并找出低效率的设计。随后,我们引入了一个与尺寸一致的纯变压器(没有移动网络块)作为设计范例。最后,我们进行了由粘力驱动的缩缩缩缩缩,最后模型的变速速度为83,但广实验显示在移动设备的性能和速度上保持效率的优越性能和速度。我们最快的模型,只有1.L1,我们最精准的变压的模型,只有1.LML1,在最精准的MIMIMI-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-L-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-L-L-I-L-L-L-I-L-I-I-I-I-I-I-L-L-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I-I