arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2206.01191cs.CV
收藏

EfficientFormer:以MobileNet的速度实现视觉Transformer

EfficientFormer: Vision Transformers at MobileNet Speed

Snap Inc.(Snap公司);Northeastern University(东北大学)

Yanyu Li, Geng Yuan, Yang Wen, Ju Hu, Georgios Evangelidis, Sergey Tulyakov, Yanzhi Wang, Jian Ren

摘要:

视觉Transformer(ViT)在计算机视觉任务中取得了快速进展,在各种基准测试中取得了令人鼓舞的结果。然而,由于大量的参数和模型设计,\textit{e.g.},注意力机制,基于ViT的模型通常比轻量级卷积网络慢几倍。因此,为实时应用部署ViT特别具有挑战性,特别是在资源受限的硬件(如移动设备)上。最近的努力试图通过网络结构搜索或与MobileNet块的混合设计来降低ViT的计算复杂度,但推理速度仍然不能令人满意。这就引出了一个重要的问题:Transformers能否在获得高性能的同时运行得像MobileNet一样快?为了回答这个问题,我们首先重新审视基于ViT的模型中使用的网络架构和运营商,并确定低效的设计。然后,我们介绍了一个尺寸一致的纯Transformer(没有MobileNet块)作为设计范例。最后,我们执行延迟驱动的瘦身,以获得一系列称为EfficientFormer的最终模型。大量的实验表明了EfficientFormer在移动设备上的性能和速度上的优越性。我们最快的模型EfficientFormer-L1在ImageNet-1 K上实现了$79.2\%$ top-1的准确性,而iPhone 12(使用CoreML编译)上的$1.6$ ms推理延迟仅为100 ms,其运行速度与MobileNetV 2 $\times 1.4$一样快($1.6$ ms,$74.7\%$ top-1),我们最大的模型EfficientFormer-L7仅以$7.0$ ms延迟获得了$83.3\%$的准确性。我们的工作证明,适当设计的Transformers可以在保持高性能的同时在移动设备上达到极低的延迟。

英文摘要:

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 $79.2\%$ top-1 accuracy on ImageNet-1K with only $1.6$ ms inference latency on iPhone 12 (compiled with CoreML), which runs as fast as MobileNetV2$\times 1.4$ ($1.6$ ms, $74.7\%$ 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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑