Skip to main content
QUICK REVIEW

[Paper Review] CrossFormer: A Versatile Vision Transformer Based on Cross-scale Attention

Wenxiao Wang, Yao Lu|arXiv (Cornell University)|Jul 31, 2021
Advanced Neural Network ApplicationsComputer Science39 references46 citations
TL;DR

CrossFormer introduces a vision transformer architecture that enables cross-scale attention through Cross-scale Embedding Layer (CEL) and Long Short Distance Attention (LSDA), allowing effective modeling of features across multiple spatial scales. By preserving both small- and large-scale features and incorporating dynamic position bias, CrossFormer achieves state-of-the-art performance on object detection and segmentation tasks.

ABSTRACT

Transformers have made much progress in dealing with visual tasks. However, existing vision transformers still do not possess an ability that is important to visual input: building the attention among features of different scales. The reasons for this problem are two-fold: (1) Input embeddings of each layer are equal-scale without cross-scale features; (2) Some vision transformers sacrifice the small-scale features of embeddings to lower the cost of the self-attention module. To make up this defect, we propose Cross-scale Embedding Layer (CEL) and Long Short Distance Attention (LSDA). In particular, CEL blends each embedding with multiple patches of different scales, providing the model with cross-scale embeddings. LSDA splits the self-attention module into a short-distance and long-distance one, also lowering the cost but keeping both small-scale and large-scale features in embeddings. Through these two designs, we achieve cross-scale attention. Besides, we propose dynamic position bias for vision transformers to make the popular relative position bias apply to variable-sized images. Based on these proposed modules, we construct our vision architecture called CrossFormer. Experiments show that CrossFormer outperforms other transformers on several representative visual tasks, especially object detection and segmentation. The code has been released: this https URL.

Motivation & Objective

  • To address the lack of cross-scale feature modeling in existing vision transformers, which typically process features at a single scale per layer.
  • To preserve both small-scale and large-scale features in self-attention mechanisms without increasing computational cost.
  • To enable relative position bias to generalize across variable-sized input images through dynamic position bias.
  • To design a unified vision transformer architecture that effectively integrates multi-scale representations for improved visual understanding.

Proposed method

  • Cross-scale Embedding Layer (CEL) fuses features from multiple patch scales into a single embedding, enabling cross-scale representation learning.
  • Long Short Distance Attention (LSDA) decomposes self-attention into short- and long-distance components, maintaining feature fidelity across scales while reducing computational cost.
  • Dynamic position bias is introduced to adapt relative position bias to variable-sized inputs, improving generalization in vision transformers.
  • The architecture integrates CEL and LSDA into a unified transformer backbone, forming CrossFormer, optimized for visual tasks.
  • The model is trained end-to-end on standard vision benchmarks with standard training protocols.

Experimental results

Research questions

  • RQ1How can vision transformers effectively attend to features across different spatial scales?
  • RQ2Can multi-scale feature representation be preserved in self-attention without increasing computational complexity?
  • RQ3How can relative position bias be adapted to work with variable-sized image inputs in vision transformers?
  • RQ4To what extent does cross-scale attention improve performance on object detection and segmentation tasks?

Key findings

  • CrossFormer achieves state-of-the-art performance on object detection and instance segmentation benchmarks, outperforming existing vision transformers.
  • The integration of cross-scale attention via CEL and LSDA leads to significant accuracy gains, particularly on fine-grained visual tasks.
  • Dynamic position bias enables effective generalization across variable input sizes, improving robustness in real-world scenarios.
  • The model maintains computational efficiency while enhancing feature representation across multiple scales, as evidenced by consistent gains across diverse visual tasks.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.