We attempt to reduce the computational costs in vision transformers (ViTs), which increase quadratically in the token number. We present a novel training paradigm that trains only one ViT model at a time, but is capable of providing improved image recognition performance with various computational costs. Here, the trained ViT model, termed super vision transformer (SuperViT), is empowered with the versatile ability to solve incoming patches of multiple sizes as well as preserve informative tokens with multiple keeping rates (the ratio of keeping tokens) to achieve good hardware efficiency for inference, given that the available hardware resources often change from time to time. Experimental results on ImageNet demonstrate that our SuperViT can considerably reduce the computational costs of ViT models with even performance increase. For example, we reduce 2x FLOPs of DeiT-S while increasing the Top-1 accuracy by 0.2% and 0.7% for 1.5x reduction. Also, our SuperViT significantly outperforms existing studies on efficient vision transformers. For example, when consuming the same amount of FLOPs, our SuperViT surpasses the recent state-of-the-art (SOTA) EViT by 1.1% when using DeiT-S as their backbones. The project of this work is made publicly available at https://github.com/lmbxmu/SuperViT.
翻译:我们尝试降低视觉变压器(ViTs)的计算成本,该类模型的计算量随令牌数量呈二次增长。我们提出了一种新型训练范式,该范式每次仅训练一个ViT模型,但能够以多种计算成本提供改进的图像识别性能。在此框架下,训练得到的ViT模型(称为超级视觉变压器SuperViT)被赋予了灵活处理多种尺寸输入补丁的能力,同时通过保留具有多种保留率(保留令牌的比例)的信息性令牌,以应对硬件资源时常变化的推理效率需求。在ImageNet上的实验结果表明,我们的SuperViT能够显著降低ViT模型的计算成本,甚至性能有所提升。例如,我们将DeiT-S的FLOPs减少2倍,同时在1.5倍降幅下Top-1准确率分别提升0.2%和0.7%。此外,我们的SuperViT在高效视觉变压器领域显著优于现有研究。例如,在消耗相同FLOPs的情况下,以DeiT-S为骨干网络时,我们的SuperViT较近期最先进(SOTA)方法EViT高出1.1%。本项目代码已开源:https://github.com/lmbxmu/SuperViT。