Skip to main content
QUICK REVIEW

[论文解读] Three things everyone should know about Vision Transformers

Hugo Touvron, Matthieu Cord|arXiv (Cornell University)|Mar 18, 2022
Advanced Neural Network Applications被引用 8
一句话总结

本文提出了视觉Transformer的三项实用改进:(1)并行化残差块以提升训练效率并降低延迟,且不损失精度;(2)仅微调注意力层以实现分辨率适应与迁移学习,节省计算与显存;(3)引入一种分层MLP主干(hMLP stem),在掩码自监督学习中实现有效的图像块预处理,显著提升BeiT及监督基准上的性能。

ABSTRACT

After their initial success in natural language processing, transformer architectures have rapidly gained traction in computer vision, providing state-of-the-art results for tasks such as image classification, detection, segmentation, and video analysis. We offer three insights based on simple and easy to implement variants of vision transformers. (1) The residual layers of vision transformers, which are usually processed sequentially, can to some extent be processed efficiently in parallel without noticeably affecting the accuracy. (2) Fine-tuning the weights of the attention layers is sufficient to adapt vision transformers to a higher resolution and to other classification tasks. This saves compute, reduces the peak memory consumption at fine-tuning time, and allows sharing the majority of weights across tasks. (3) Adding MLP-based patch pre-processing layers improves Bert-like self-supervised training based on patch masking. We evaluate the impact of these design choices using the ImageNet-1k dataset, and confirm our findings on the ImageNet-v2 test set. Transfer performance is measured across six smaller datasets.

研究动机与目标

  • 探索在不牺牲精度的前提下,提升视觉Transformer训练效率与推理延迟的架构改进。
  • 研究仅微调ViT的注意力层是否足以实现对更高分辨率或新分类任务的适应。
  • 设计一种与基于掩码的自监督学习方法(如BeiT)兼容的图像块预处理主干,同时提升性能并保留归纳偏置。
  • 在多个基准上评估这些设计选择的影响,包括ImageNet-1k、ImageNet-v2,以及在六个较小数据集上的迁移学习。

提出的方法

  • 提出一种并行化架构,将多头自注意力(MHSA)与前馈网络(FFN)块重组为成对结构,实现更宽、更浅的网络,且FLOPS与参数量保持不变。
  • 引入一种微调策略:冻结FFN层,仅在适应新分辨率或下游任务时更新注意力权重。
  • 设计一种分层MLP(hMLP)主干,通过多层线性变换与非线性激活,并结合图像块聚合,确保无块间通信,以保持自监督学习中的掩码结构。
  • 在ViT编码器前应用hMLP主干,掩码在预处理后施加,以确保与掩码自编码方法(如BeiT)的兼容性。
  • 采用标准训练协议:监督预训练300个周期,微调任务100个周期,并使用LayerScale与标准数据增强。
  • 在保持一致超参数与随机种子的前提下,对比多种主干设计(线性、批归一化、卷积、hMLP)在ImageNet-1k与迁移学习基准上的性能。

实验结果

研究问题

  • RQ1在视觉Transformer中并行化残差块是否能提升训练效率与推理延迟,同时不降低精度?
  • RQ2是否可能仅微调ViT的注意力层,即可实现分辨率适应或迁移学习,同时保持竞争力的性能?
  • RQ3能否设计一种与基于掩码的自监督学习(如BeiT)兼容的图像块预处理主干,同时提升性能?
  • RQ4与现有卷积与线性主干相比,所提出的hMLP主干在精度、FLOPS及监督与自监督设置下的泛化能力方面表现如何?

主要发现

  • 并行化ViT块可改善优化过程,并在GPU上降低延迟,尤其在小批量时效果显著,同时保持或轻微提升精度。
  • 仅微调注意力层在将ViT适配至更高分辨率或新分类任务时,可达到与全量微调相当的精度,显著降低计算与显存消耗。
  • hMLP主干在BeiT预训练下,使ImageNet-v2的top-1准确率提升+0.38%,ImageNet-val提升+0.39%,优于线性与卷积主干。
  • hMLP主干在监督学习中性能与最佳卷积主干(LeViT)相当,但FLOPS减少1.15倍,且避免了块间通信。
  • 现有卷积主干在BeiT预训练中因干扰掩码机制而无法提升性能,而hMLP主干成功结合了图像块预处理与掩码预测的优势。
  • 与ViT-B12相比,hMLP主干仅增加0.8%的FLOPS,却在自监督与迁移学习设置中带来显著的精度提升。

更好的研究,从现在开始

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

无需绑定信用卡

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