Skip to main content
QUICK REVIEW

[论文解读] Patch Slimming for Efficient Vision Transformers

Yehui Tang, Kai Han|arXiv (Cornell University)|Jun 5, 2021
Advanced Neural Network Applications参考文献 31被引用 12
一句话总结

本文提出了一种名为 Patch Slimming 的视觉变换器自顶向下剪枝方法,通过评估每个图像块对最终分类特征的影响,移除冗余的图像块。通过估计每个图像块对类别标记的贡献,并仅保留最具影响力的图像块,该方法在 ViT-Tiny 上实现了超过 45% 的 FLOPs 减少,且在 ImageNet 上仅造成 0.2% 的准确率下降。

ABSTRACT

This paper studies the efficiency problem for visual transformers by excavating redundant calculation in given networks. The recent transformer architecture has demonstrated its effectiveness for achieving excellent performance on a series of computer vision tasks. However, similar to that of convolutional neural networks, the huge computational cost of vision transformers is still a severe issue. Considering that the attention mechanism aggregates different patches layer-by-layer, we present a novel patch slimming approach that discards useless patches in a top-down paradigm. We first identify the effective patches in the last layer and then use them to guide the patch selection process of previous layers. For each layer, the impact of a patch on the final output feature is approximated and patches with less impact will be removed. Experimental results on benchmark datasets demonstrate that the proposed method can significantly reduce the computational costs of vision transformers without affecting their performances. For example, over 45% FLOPs of the ViT-Ti model can be reduced with only 0.2% top-1 accuracy drop on the ImageNet dataset.

研究动机与目标

  • 解决视觉变换器的高计算成本问题,以促进其在资源受限设备上的部署。
  • 识别并移除各层中的冗余图像块,而非如卷积神经网络中剪枝通道。
  • 开发一种结构化的剪枝策略,在加速推理的同时保持模型性能。
  • 通过一种有原则的、误差可控的图像块移除过程,实现视觉变换器的高效部署。
  • 证明深层网络中图像块级别的冗余性显著高于浅层网络。

提出的方法

  • 提出一种自顶向下的剪枝框架,从最后一层开始,逐步向网络前向推进。
  • 通过误差反向传播测量每个图像块对最终输出特征(类别标记)的影响,来估计其重要性。
  • 使用全局容错误差阈值 ε 来控制 FLOPs 减少与准确率损失之间的权衡。
  • 若深层网络中任意对应空间位置的图像块被保留,则也保留该图像块,以确保信息流的完整性。
  • 采用可微分的基于梯度的评分方法,按其对最终预测的贡献对图像块进行排序。
  • 使用重构误差近似来估计每个图像块的重要性,而无需完整微调。

实验结果

研究问题

  • RQ1是否能有效识别并移除视觉变换器中的图像块级冗余,而不会造成显著的性能下降?
  • RQ2视觉变换器中不同层的图像块冗余性如何变化?
  • RQ3与均匀剪枝或随机剪枝相比,自顶向下的剪枝策略是否能更有效地在保持模型性能的同时减少 FLOPs?
  • RQ4在剪枝图像块时,FLOPs 减少与准确率损失之间的最优权衡是什么?
  • RQ5与基于注意力机制或随机剪枝的基线方法相比,所提出的影响力估计方法在保留模型效用方面表现如何?

主要发现

  • 所提出的 Patch Slimming 方法在 ViT-Tiny 模型上实现了 45.2% 的 FLOPs 减少,且在 ImageNet 上 top-1 准确率仅下降 0.2%。
  • DeiT-S 实现了 45.8% 的 FLOPs 减少,准确率下降 0.2%,优于均匀剪枝(top-1 准确率为 77.2%,下降 2.6%)。
  • 深层网络中图像块的冗余性显著高于浅层网络,这为自顶向下的剪枝策略提供了合理性。
  • 在相同剪枝率下,所提出的影响力估计方法导致的准确率损失低于随机剪枝或基于注意力的剪枝基线。
  • 剪枝后的模型呈现出金字塔状架构,浅层保留更多图像块,深层则移除更多图像块。
  • 该方法在高剪枝率下仍保持高性能,当 FLOPs 减少低于 45% 时,准确率下降不足 0.4%。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。