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

EfficientViT:具有级联分组注意力的内存高效视觉Transformer

EfficientViT: Memory Efficient Vision Transformer with Cascaded Group Attention

The Chinese University of Hong Kong(香港中文大学);Microsoft Research(微软研究院)

Xinyu Liu, Houwen Peng, Ningxin Zheng, Yuqing Yang, Han Hu, Yixuan Yuan

AI总结:

本文提出EfficientViT,通过三明治布局和级联分组注意力提升内存效率与注意力多样性,在速度和准确性上超越现有高效模型,如EfficientViT-M5在GPU和CPU上大幅提升吞吐量。

摘要:

视觉Transformer因其强大的模型能力而取得了巨大成功。然而,其卓越的性能伴随着高昂的计算成本,使其不适合实时应用。在本文中,我们提出了一系列名为EfficientViT的高速视觉Transformer。我们发现现有Transformer模型的速度通常受限于内存效率低下的操作,尤其是MHSA中的张量重塑和逐元素函数。因此,我们设计了一种具有三明治布局的新构建块,即在高效的FFN层之间使用单个内存受限的MHSA,这提高了内存效率,同时增强了通道通信。此外,我们发现注意力图在不同头之间高度相似,导致计算冗余。为了解决这个问题,我们提出了一个级联分组注意力模块,将完整特征的不同分割馈送给注意力头,这不仅节省了计算成本,还提高了注意力多样性。综合实验表明,EfficientViT优于现有的高效模型,在速度和准确性之间取得了良好的权衡。例如,我们的EfficientViT-M5在准确性上超过MobileNetV3-Large 1.9%,同时在Nvidia V100 GPU和Intel Xeon CPU上分别获得40.4%和45.2%更高的吞吐量。与最近的高效模型MobileViT-XXS相比,EfficientViT-M2在准确性上高出1.8%,同时在GPU/CPU上运行速度快5.8倍/3.7倍,转换为ONNX格式时快7.4倍。代码和模型可在https://github.com/microsoft/Cream/tree/main/EfficientViT获取。

英文摘要:

Vision transformers have shown great success due to their high model capabilities. However, their remarkable performance is accompanied by heavy computation costs, which makes them unsuitable for real-time applications. In this paper, we propose a family of high-speed vision transformers named EfficientViT. We find that the speed of existing transformer models is commonly bounded by memory inefficient operations, especially the tensor reshaping and element-wise functions in MHSA. Therefore, we design a new building block with a sandwich layout, i.e., using a single memory-bound MHSA between efficient FFN layers, which improves memory efficiency while enhancing channel communication. Moreover, we discover that the attention maps share high similarities across heads, leading to computational redundancy. To address this, we present a cascaded group attention module feeding attention heads with different splits of the full feature, which not only saves computation cost but also improves attention diversity. Comprehensive experiments demonstrate EfficientViT outperforms existing efficient models, striking a good trade-off between speed and accuracy. For instance, our EfficientViT-M5 surpasses MobileNetV3-Large by 1.9% in accuracy, while getting 40.4% and 45.2% higher throughput on Nvidia V100 GPU and Intel Xeon CPU, respectively. Compared to the recent efficient model MobileViT-XXS, EfficientViT-M2 achieves 1.8% superior accuracy, while running 5.8x/3.7x faster on the GPU/CPU, and 7.4x faster when converted to ONNX format. Code and models are available at https://github.com/microsoft/Cream/tree/main/EfficientViT.

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

↑