Skip to main content
QUICK REVIEW

[论文解读] Dilated Neighborhood Attention Transformer

Ali Hassani, Humphrey Shi|arXiv (Cornell University)|Sep 29, 2022
Advanced Neural Network ApplicationsComputer Science被引用 28
一句话总结

DiNAT 将局部邻域注意力与扩张的稀疏全局注意力(DiNA)结合起来,在不增加额外计算的情况下使感受野指数级扩展,在若干视觉任务上取得近似SOTA的结果,并开源发布。

ABSTRACT

Transformers are quickly becoming one of the most heavily applied deep learning architectures across modalities, domains, and tasks. In vision, on top of ongoing efforts into plain transformers, hierarchical transformers have also gained significant attention, thanks to their performance and easy integration into existing frameworks. These models typically employ localized attention mechanisms, such as the sliding-window Neighborhood Attention (NA) or Swin Transformer's Shifted Window Self Attention. While effective at reducing self attention's quadratic complexity, local attention weakens two of the most desirable properties of self attention: long range inter-dependency modeling, and global receptive field. In this paper, we introduce Dilated Neighborhood Attention (DiNA), a natural, flexible and efficient extension to NA that can capture more global context and expand receptive fields exponentially at no additional cost. NA's local attention and DiNA's sparse global attention complement each other, and therefore we introduce Dilated Neighborhood Attention Transformer (DiNAT), a new hierarchical vision transformer built upon both. DiNAT variants enjoy significant improvements over strong baselines such as NAT, Swin, and ConvNeXt. Our large model is faster and ahead of its Swin counterpart by 1.6% box AP in COCO object detection, 1.4% mask AP in COCO instance segmentation, and 1.4% mIoU in ADE20K semantic segmentation. Paired with new frameworks, our large variant is the new state of the art panoptic segmentation model on COCO (58.5 PQ) and ADE20K (49.4 PQ), and instance segmentation model on Cityscapes (45.1 AP) and ADE20K (35.4 AP) (no extra data). It also matches the state of the art specialized semantic segmentation models on ADE20K (58.1 mIoU), and ranks second on Cityscapes (84.5 mIoU) (no extra data).

研究动机与目标

  • 激发在层次化视觉变换器中平衡局部注意力效率与全局上下文的需求。
  • 提出 DiNA,通过扩张来扩展 Neighborhood Attention,从而实现稀疏全局注意力。
  • 构建一个分层视觉变换器(DiNAT),在交替层中利用 NA 与 DiNA。
  • 在图像分类、目标检测和分割任务上评估 DiNAT,以与 NAT、Swin 和 ConvNeXt 进行比较。
  • 提供实现并开源,以支持在稀疏/全局注意力模式下的视觉变换器研究。

提出的方法

  • 将 DiNA 定义为基于扩张的 Neighborhood Attention (NA) 的扩展,在扩张约束下选择第 i 个 token 的第 j 个最近邻。
  • 用 Q_i 和 K_{ρ_j^{δ}(i)} 以及相应的 B(i, ρ_j^{δ}(i)) 来公式化 DiNA 注意力权重 A_i^{(k,δ)}。
  • 将 DiNA 输出计算为 DiNA_{k}^{δ}(i) = softmax(A_i^{(k,δ)}/sqrt(d)) V_i^{(k,δ)},其中 d 为嵌入维度。
  • 引入 DiNAT,作为在各层中结合 NA 与 DiNA 的分层变换器,具有每层的扩张 δ 和下采样方案。
  • 分析感受野增长:DiNA 使感受野在 NAT 的线性增长与跨 ℓ 层的指数级增长 k^{ℓ} 之间扩展。
  • 扩展 NATTEN(CUDA 内核)以支持扩张,从而实现高效的 DiNA 实现。

实验结果

研究问题

  • RQ1一个带扩张的稀疏全局注意力(DiNA)是否能在扩展感受野的同时保留局部性,超过单独局部注意力的效果?
  • RQ2将 NA 与 DiNA 结合的混合架构(DiNAT)在分类、检测和分割任务上是否优于强基线(NAT、Swin、ConvNeXt)?
  • RQ3每层扩张值对感受野、效率和下游任务性能的影响是什么?
  • RQ4DiNAT 在数据规模(ImageNet-1K/22K)和任务(分类、检测、分割、全景分割)上的扩展性如何?
  • RQ5相较于完整自注意力,NA/DiNA 变体在各向同性与分层结构上的权衡是什么?

主要发现

  • DiNA 在 NA 的基础上扩展稀疏全局注意力,使感受野指数级扩展且不增加额外计算成本。
  • 将 NA 与 DiNA 层级堆叠的 DiNAT,在下游视觉任务上相较于 NAT、Swin 和 ConvNeXt 基线有提升。
  • 在 ImageNet-1K 的 224^2 上,DiNAT 变体在若干配置中达到或超过 NAT,并与 ConvNeXt/Swin 基线竞争力;在 ImageNet-22K 的大规模预训练显示对比 Swin-Large/ConvNeXt-Large 具有竞争力。
  • DiNAT-L 在 ImageNet-1K 上以 200M 参数和 30.6 GFLOPs 达到 86.6% top-1,并在下游分割任务(Panoptic/Instance/Semantic)中展示出竞争力或优越性,且无需额外数据。
  • 各向同性变体(DiNAT 与具有 ViT 风格各向同性设计的 NAT)在 FLOPs 和参数相同的情况下,与 ViT 和 ConvNeXt 基线相比显示出具有竞争力的准确率。
  • 开源发布在 NA/NATTEN 上扩展了扩张支持,并支持跨视觉任务及潜在领域的研究。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。