Skip to main content
QUICK REVIEW

[论文解读] CAS-ViT: Convolutional Additive Self-attention Vision Transformers for Efficient Mobile Applications

Tianfang Zhang, Lei Li|arXiv (Cornell University)|Aug 7, 2024
Advanced Neural Network ApplicationsComputer Science被引用 17
一句话总结

CAS-ViT 提出一个卷积加性 Token 混合器(CATM)来取代标准自注意力,实现线性复杂度且适用于移动和边缘设备的竞争性准确率。它在分类、检测和分割任务上通过 GPU、ONNX 和 iPhone 部署进行评估。

ABSTRACT

Vision Transformers (ViTs) mark a revolutionary advance in neural networks with their token mixer's powerful global context capability. However, the pairwise token affinity and complex matrix operations limit its deployment on resource-constrained scenarios and real-time applications, such as mobile devices, although considerable efforts have been made in previous works. In this paper, we introduce CAS-ViT: Convolutional Additive Self-attention Vision Transformers, to achieve a balance between efficiency and performance in mobile applications. Firstly, we argue that the capability of token mixers to obtain global contextual information hinges on multiple information interactions, such as spatial and channel domains. Subsequently, we propose Convolutional Additive Token Mixer (CATM) employing underlying spatial and channel attention as novel interaction forms. This module eliminates troublesome complex operations such as matrix multiplication and Softmax. We introduce Convolutional Additive Self-attention(CAS) block hybrid architecture and utilize CATM for each block. And further, we build a family of lightweight networks, which can be easily extended to various downstream tasks. Finally, we evaluate CAS-ViT across a variety of vision tasks, including image classification, object detection, instance segmentation, and semantic segmentation. Our M and T model achieves 83.0\%/84.1\% top-1 with only 12M/21M parameters on ImageNet-1K. Meanwhile, throughput evaluations on GPUs, ONNX, and iPhones also demonstrate superior results compared to other state-of-the-art backbones. Extensive experiments demonstrate that our approach achieves a better balance of performance, efficient inference and easy-to-deploy. Our code and model are available at: \url{https://github.com/Tianfang-Zhang/CAS-ViT}

研究动机与目标

  • 在资源受限/移动场景中为 Vision Transformers (ViTs) 提出高效的 token mixer 的动机。
  • 提出一种卷积加性 Token Mixer (CATM),通过卷积运算实现线性复杂度的自注意力。
  • 展示 CAS-ViT 在分类、检测、实例分割和语义分割任务中的竞争性准确性与部署效率。
  • 通过在 GPU、ONNX 和 iPhone 部署上评估吞吐量,展示其实用性。

提出的方法

  • 定义一个新颖的加性相似性函数 Sim(Q,K) = Phi(Q) + Phi(K),其中 Phi 结合空间和通道交互。
  • 使用深度卷积 + Sigmoid 空间注意力和简化的通道注意力实现卷积加性 Token Mixer (CATM)。
  • 将 CAS-ViT 构建为四阶段的轻量级 ViT,跨层使用基于 CATM 的模块,以及一个集成子网和带残差的 MLP。
  • 分析计算复杂度,使整体对输入规模呈线性复杂度(Omega(CATM) ~ (47+10b)HWC)。
  • 在 ImageNet-1K 上从头训练,然后进行下游任务和通过 CoreML 与 ONNX 的移动部署。
Figure 1: Flops v.s. Top-1 accuracy on ImageNet-1K (Deng et al. 2009 ) . The circle size indicates parameter number and best viewed in color.
Figure 1: Flops v.s. Top-1 accuracy on ImageNet-1K (Deng et al. 2009 ) . The circle size indicates parameter number and best viewed in color.

实验结果

研究问题

  • RQ1卷积基础的加性注意机制是否能够在移动部署中实现线性时间复杂度的同时获得与 ViT 相竞争的性能?
  • RQ2在加性相似性中整合空间和通道交互对视觉任务的准确性和效率有何影响?
  • RQ3在 GPU、ONNX 和 iPhone 硬件上,CAS-ViT 的吞吐量和准确性权衡如何?
  • RQ4与最先进的骨干网络相比,CAS-ViT 在检测、实例分割和语义分割上的表现如何?

主要发现

  • CAS-ViT 的变体在 ImageNet-1K 上以相对较低的参数量和 FLOPs 实现了与 Top-1 相竞争的准确性。
  • CATM 保持线性复杂度,避免基于 Softmax 的高复杂度计算,同时结合了空间与通道交互。
  • 在目标检测/实例分割中,CAS-ViT 骨干(如 CAS-ViT-S/M)显示出在 FLOPs 相近或更低的情况下具有更好的 AP 指标。
  • 在 ADE20K 上的语义分割中,CAS-ViT-M 的 mIoU 达到 43.6%,且 FLOPs 相对较低。
  • 在 GPU、ONNX 和 Apple Neural Engine 上的吞吐量分析显示其具备实际的移动部署潜力。
Figure 2: Comparison of diverse self-attention mechanisms. (a) is the classical multi-head self-attention in ViT (Dosovitskiy et al. 2020 ) . (b) is the separable self-attention in MobileViTv2 (Mehta and Rastegari 2022 ) , which reduces the feature metric of a matrix to a vector. (c) is the swift se
Figure 2: Comparison of diverse self-attention mechanisms. (a) is the classical multi-head self-attention in ViT (Dosovitskiy et al. 2020 ) . (b) is the separable self-attention in MobileViTv2 (Mehta and Rastegari 2022 ) , which reduces the feature metric of a matrix to a vector. (c) is the swift se

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。