Skip to main content
QUICK REVIEW

[Paper Review] Vision Transformer with Deformable Attention

Zhuofan Xia, Xuran Pan|arXiv (Cornell University)|Jan 3, 2022
Advanced Neural Network ApplicationsComputer Science15 citations
TL;DR

This paper proposes Deformable Attention Transformer (DAT), a vision transformer backbone with a novel deformable self-attention mechanism that learns data-dependent key/value sampling locations via shared offsets per query group, enabling efficient, adaptive attention. The method achieves state-of-the-art performance, improving top-1 accuracy by 0.7% on ImageNet, 1.2% on ADE20K semantic segmentation, and 1.1% on COCO detection over strong baselines like Swin Transformer.

ABSTRACT

Transformers have recently shown superior performances on various vision tasks. The large, sometimes even global, receptive field endows Transformer models with higher representation power over their CNN counterparts. Nevertheless, simply enlarging receptive field also gives rise to several concerns. On the one hand, using dense attention e.g., in ViT, leads to excessive memory and computational cost, and features can be influenced by irrelevant parts which are beyond the region of interests. On the other hand, the sparse attention adopted in PVT or Swin Transformer is data agnostic and may limit the ability to model long range relations. To mitigate these issues, we propose a novel deformable self-attention module, where the positions of key and value pairs in self-attention are selected in a data-dependent way. This flexible scheme enables the self-attention module to focus on relevant regions and capture more informative features. On this basis, we present Deformable Attention Transformer, a general backbone model with deformable attention for both image classification and dense prediction tasks. Extensive experiments show that our models achieve consistently improved results on comprehensive benchmarks. Code is available at https://github.com/LeapLabTHU/DAT.

Motivation & Objective

  • To address the inefficiency and suboptimal attention distribution in standard Vision Transformers and sparse attention mechanisms like Swin Transformer.
  • To overcome the limitations of data-agnostic attention patterns that may discard relevant features or retain irrelevant ones.
  • To introduce a differentiable, efficient deformable attention mechanism that adapts to input content without increasing computational complexity quadratically.
  • To design a general-purpose, convolution-free backbone model that consistently outperforms existing vision transformers across classification and dense prediction tasks.

Proposed method

  • Proposes a deformable self-attention module where key and value positions are shifted via learnable offsets generated from query features, enabling data-dependent attention.
  • Introduces shared, query-agnostic offsets across all queries in a group, reducing memory and computation cost while maintaining flexibility.
  • Uses uniform reference points as initial sampling locations, which are then deformed via an offset network conditioned on query features.
  • Employs a lightweight offset network that predicts shifts for each reference point based on the query, allowing dynamic focus on salient regions.
  • Constructs a pyramid-shaped backbone, Deformable Attention Transformer (DAT), suitable for both image classification and dense prediction tasks.
  • Maintains linear space complexity by avoiding per-query offset learning, unlike deformable convolutions in CNNs or prior deformable attention in Transformers.

Experimental results

Research questions

  • RQ1Can a data-dependent attention mechanism improve feature representation in vision transformers while maintaining computational efficiency?
  • RQ2How does learning shared, query-agnostic offsets for key/value sampling compare to query-specific or fixed-pattern attention in terms of performance and efficiency?
  • RQ3To what extent does deformable attention enhance modeling of long-range dependencies and object-specific features in image recognition tasks?
  • RQ4Can a deformable attention mechanism be effectively integrated into a pure Transformer backbone without introducing convolutional components?

Key findings

  • DAT achieves 82.0% top-1 accuracy on ImageNet-1K, outperforming Swin Transformer by 0.7% under similar FLOPs and parameter counts.
  • On the ADE20K semantic segmentation benchmark, DAT improves mIoU by 1.2% over competitive baselines, with particularly strong gains on small and large objects (up to 2.1%).
  • For COCO object detection, DAT improves both box AP and mask AP by 1.1% compared to Swin Transformer, demonstrating consistent gains across detection and segmentation tasks.
  • The model with convolutional patch embeddings (DAT-T*) achieves 82.7% top-1 accuracy on ImageNet, a 0.7% improvement over the original DAT-T and a 0.7% gain over the best baseline.
  • Visualizations confirm that deformable attention focuses on foreground objects and geometrically complex regions, such as multiple donuts or giraffes, while Swin Transformer tends to attend to local, less relevant patches.
  • Memory and FLOP analysis shows that DAT uses 2.6× less memory and 1.3× fewer FLOPs than D-DETR with similar key counts, while achieving higher accuracy.

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.