SwiftFormer: Efficient Additive Attention for Transformer-based Real-time Mobile Vision ApplicationsShow others and affiliations
2023 (English)In: 2023 IEEE/CVF INTERNATIONAL CONFERENCE ON COMPUTER VISION (ICCV 2023), IEEE COMPUTER SOC , 2023, p. 17379-17390Conference paper, Published paper (Refereed)
Abstract [en]
Self-attention has become a defacto choice for capturing global context in various vision applications. However, its quadratic computational complexity with respect to image resolution limits its use in real-time applications, especially for deployment on resource-constrained mobile devices. Although hybrid approaches have been proposed to combine the advantages of convolutions and self-attention for a better speed-accuracy trade-off, the expensive matrix multiplication operations in self-attention remain a bottleneck. In this work, we introduce a novel efficient additive attention mechanism that effectively replaces the quadratic matrix multiplication operations with linear element-wise multiplications. Our design shows that the key-value interaction can be replaced with a linear layer without sacrificing any accuracy. Unlike previous state-of-the-art methods, our efficient formulation of self-attention enables its usage at all stages of the network. Using our proposed efficient additive attention, we build a series of models called "Swift-Former" which achieves state-of-the-art performance in terms of both accuracy and mobile inference speed. Our small variant achieves 78.5% top-1 ImageNet-1K accuracy with only 0.8 ms latency on iPhone 14, which is more accurate and 2 faster compared to MobileViT-v2. Our code and models: https://tinyurl.com/5ft8v46w
Place, publisher, year, edition, pages
IEEE COMPUTER SOC , 2023. p. 17379-17390
Series
IEEE International Conference on Computer Vision, ISSN 1550-5499, E-ISSN 2380-7504
National Category
Other Computer and Information Science
Identifiers
URN: urn:nbn:se:liu:diva-203144DOI: 10.1109/ICCV51070.2023.01598ISI: 001169500502001ISBN: 9798350307184 (electronic)ISBN: 9798350307191 (print)OAI: oai:DiVA.org:liu-203144DiVA, id: diva2:1855327
Conference
IEEE/CVF International Conference on Computer Vision (ICCV), Paris, FRANCE, oct 02-06, 2023
2024-04-302024-04-302024-04-30