Skip to main content
QUICK REVIEW

[论文解读] CrossFormer: A Versatile Vision Transformer Hinging on Cross-scale Attention

Wenxiao Wang, Yao Lu|arXiv (Cornell University)|Jul 31, 2021
Advanced Neural Network Applications被引用 85
一句话总结

CrossFormer 在视觉 transformer 中引入跨尺度嵌入和长短距离注意力,以实现跨尺度交互,并为变量输入尺寸引入动态位置偏置,在分类、检测、实例分割和语义分割等任务上取得强结果。

ABSTRACT

Transformers have made great progress in dealing with computer vision tasks. However, existing vision transformers do not yet possess the ability of building the interactions among features of different scales, which is perceptually important to visual inputs. The reasons are two-fold: (1) Input embeddings of each layer are equal-scale, so no cross-scale feature can be extracted; (2) to lower the computational cost, some vision transformers merge adjacent embeddings inside the self-attention module, thus sacrificing small-scale (fine-grained) features of the embeddings and also disabling the cross-scale interactions. To this end, we propose Cross-scale Embedding Layer (CEL) and Long Short Distance Attention (LSDA). On the one hand, CEL blends each embedding with multiple patches of different scales, providing the self-attention module itself with cross-scale features. On the other hand, LSDA splits the self-attention module into a short-distance one and a long-distance counterpart, which not only reduces the computational burden but also keeps both small-scale and large-scale features in the embeddings. Through the above two designs, we achieve cross-scale attention. Besides, we put forward a dynamic position bias for vision transformers to make the popular relative position bias apply to variable-sized images. Hinging on the cross-scale attention module, we construct a versatile vision architecture, dubbed CrossFormer, which accommodates variable-sized inputs. Extensive experiments show that CrossFormer outperforms the other vision transformers on image classification, object detection, instance segmentation, and semantic segmentation tasks. The code has been released: https://github.com/cheerss/CrossFormer.

研究动机与目标

  • 动机:在多样化视觉任务中,说明在视觉 transformer 中实现跨尺度特征交互的必要性。
  • 提出在不产生过高计算成本的情况下实现跨尺度注意力的机制。
  • 开发一种能够在不同任务中处理可变大小输入的通用架构。

提出的方法

  • 跨尺度嵌入层(CEL)在每个嵌入中对多个尺度采样补丁,并把它们拼接成跨尺度嵌入。
  • 长短距离注意力(LSDA)将自注意力分成短距离注意力(SDA)和长距离注意力(LDA),在减少计算量的同时保留小尺度与大尺度特征。
  • 动态位置偏置(DPB)使用多层感知器(MLP)从嵌入距离生成相对位置偏置,从而支持可变的图像/组大小。
  • 构建一个带有 CEL 和 CrossFormer 块(LSDA + DPB)的金字塔架构,以支持多阶段和多样的视觉任务。
  • 构建四种 CrossFormer 变体(T、S、B、L),覆盖从小到大的模型规模和不同的下游需求。

实验结果

研究问题

  • RQ1跨尺度嵌入和长短距离注意力是否能在视觉 transformer 中实现有效的跨尺度交互?
  • RQ2动态位置偏置是否提高对跨任务的可变输入尺寸和分组的鲁棒性?
  • RQ3CrossFormer 模型是否在分类、检测、实例/语义分割等任务上相比当前最先进的视觉 transformer 提高准确性与任务性能?
  • RQ4CEL 与 LSDA 如何在不牺牲小尺度细节的前提下提升计算效率?
  • RQ5在密集预测任务(检测/分割)上的提升是否比在图像分类上更明显?

主要发现

  • CrossFormer 在参数量和 FLOPs 相近的情况下,始终在 ImageNet 分类上超过最先进的视觉 transformer。
  • CrossFormer-S/B/L 在不同模型规模上均优于强基线(如 DeiT、Swin),在较大模型上有显著提升。
  • 在 COCO 目标检测和实例分割上,CrossFormer 的变体达到更高的 AP 指标,并且对较大模型的提升更大。
  • 在 ADE20K 上使用 CrossFormer 主干的语义分割获得更高的 IOU / MS IOU 分数,尤其是对更大变体。
  • 消融实验表明跨尺度嵌入和 LSDA 的表现优于 PVT 及 Swin 类注意力,且 DPB 的性能达到与 RPB 相同的表现,并为可变输入尺寸带来额外灵活性。

更好的研究,从现在开始

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

无需绑定信用卡

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