arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2303.08685cs.CVcs.LG
收藏

从令牌稀疏化的角度使视觉Transformer高效

Making Vision Transformers Efficient from A Token Sparsification View

National University of Singapore(新加坡国立大学);Alibaba Group(阿里巴巴集团);Amazon(亚马逊)

Shuning Chang, Pichao Wang, Ming Lin, Fan Wang, David Junhao Zhang, Rong Jin, Mike Zheng Shou

摘要:

视觉Transformer(ViTs)的计算复杂性与符号数成二次方关系,限制了ViTs的实际应用。一些作品提出修剪冗余令牌,以实现高效的ViT。然而,这些方法通常遭受(i)显著的精度下降,(ii)在本地视觉Transformer中的应用困难,以及(iii)用于下游任务的非通用网络。在这项工作中,我们提出了一种新的语义令牌ViT(STViT),有效的全球和本地视觉Transformer,也可以修改为骨干下游任务。语义标记代表聚类中心,通过空间上的图像标记池化初始化并由注意力恢复,自适应地表示全局或局部语义信息。由于聚类特性,对于全局和局部视觉Transformer,少量语义标记可以达到与大量图像标记相同的效果。例如,在DeiT-(Tiny,Small,Base)上只有16个语义标记可以实现相同的准确度,推理速度提高了100%以上,FLOPs减少了近60%;在Swin-(Tiny,Small,Base)上,我们可以在每个窗口中使用16个语义标记,以进一步加快约20%的速度,精度略有增加。除了在图像分类中取得了巨大的成功外,我们还将我们的方法扩展到视频识别。此外,我们设计了一个STViT-R(ecover)网络来恢复基于STViT的详细空间信息,使其能够用于下游任务,这是以前的令牌稀疏化方法无能为力的。实验结果表明,该方法在目标检测和实例分割方面与原网络相比具有较好的性能,骨干网的FLOPs减少了30%以上。代码可在http://github.com/changsn/STViT-R上获得

英文摘要:

The quadratic computational complexity to the number of tokens limits the practical applications of Vision Transformers (ViTs). Several works propose to prune redundant tokens to achieve efficient ViTs. However, these methods generally suffer from (i) dramatic accuracy drops, (ii) application difficulty in the local vision transformer, and (iii) non-general-purpose networks for downstream tasks. In this work, we propose a novel Semantic Token ViT (STViT), for efficient global and local vision transformers, which can also be revised to serve as backbone for downstream tasks. The semantic tokens represent cluster centers, and they are initialized by pooling image tokens in space and recovered by attention, which can adaptively represent global or local semantic information. Due to the cluster properties, a few semantic tokens can attain the same effect as vast image tokens, for both global and local vision transformers. For instance, only 16 semantic tokens on DeiT-(Tiny,Small,Base) can achieve the same accuracy with more than 100% inference speed improvement and nearly 60% FLOPs reduction; on Swin-(Tiny,Small,Base), we can employ 16 semantic tokens in each window to further speed it up by around 20% with slight accuracy increase. Besides great success in image classification, we also extend our method to video recognition. In addition, we design a STViT-R(ecover) network to restore the detailed spatial information based on the STViT, making it work for downstream tasks, which is powerless for previous token sparsification methods. Experiments demonstrate that our method can achieve competitive results compared to the original networks in object detection and instance segmentation, with over 30% FLOPs reduction for backbone. Code is available at http://github.com/changsn/STViT-R

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

↑