Skip to main content
QUICK REVIEW

[Paper Review] Focal Self-attention for Local-Global Interactions in Vision Transformers

Jianwei Yang, Chunyuan Li|arXiv (Cornell University)|Jul 1, 2021
Visual Attention and Saliency DetectionComputer Science87 references267 citations
TL;DR

This paper introduces focal self-attention that combines fine-grained local and coarse-grained global interactions within Vision Transformers, yielding state-of-the-art results on ImageNet, COCO, and ADE20K across multiple model sizes.

ABSTRACT

Recently, Vision Transformer and its variants have shown great promise on various computer vision tasks. The ability of capturing short- and long-range visual dependencies through self-attention is arguably the main source for the success. But it also brings challenges due to quadratic computational overhead, especially for the high-resolution vision tasks (e.g., object detection). In this paper, we present focal self-attention, a new mechanism that incorporates both fine-grained local and coarse-grained global interactions. Using this new mechanism, each token attends the closest surrounding tokens at fine granularity but the tokens far away at coarse granularity, and thus can capture both short- and long-range visual dependencies efficiently and effectively. With focal self-attention, we propose a new variant of Vision Transformer models, called Focal Transformer, which achieves superior performance over the state-of-the-art vision Transformers on a range of public image classification and object detection benchmarks. In particular, our Focal Transformer models with a moderate size of 51.1M and a larger size of 89.8M achieve 83.5 and 83.8 Top-1 accuracy, respectively, on ImageNet classification at 224x224 resolution. Using Focal Transformers as the backbones, we obtain consistent and substantial improvements over the current state-of-the-art Swin Transformers for 6 different object detection methods trained with standard 1x and 3x schedules. Our largest Focal Transformer yields 58.7/58.9 box mAPs and 50.9/51.3 mask mAPs on COCO mini-val/test-dev, and 55.4 mIoU on ADE20K for semantic segmentation, creating new SoTA on three of the most challenging computer vision tasks.

Motivation & Objective

  • Motivate and address the quadratic cost of full self-attention for high-resolution vision tasks like detection and segmentation.
  • Propose focal self-attention to model local fine-grained and global coarse-grained interactions efficiently.
  • Develop Focal Transformer variants with multi-scale architecture for accurate dense predictions.
  • Empirically validate improvements over SoTA transformers on classification, detection, and segmentation tasks.

Proposed method

  • Define focal self-attention that attends to nearby tokens at fine granularity and distant tokens at coarser granularity.
  • Implement window-wise focal self-attention by partitioning feature maps into windows and pooling sub-windows for multiple focal levels.
  • Compute queries, keys, and values with linear projections and apply multi-level attention with relative position biases.
  • Adopt a multi-stage, multi-scale architecture with patch embeddings and stage-wise focal blocks to handle high-resolution inputs.
  • Train and evaluate Focal Transformer variants (Focal-Tiny, Focal-Small, Focal-Base) on ImageNet-1K, COCO, and ADE20K, comparing to Swin Transformers and other baselines.

Experimental results

Research questions

  • RQ1Can focal self-attention capture both local and global interactions in Vision Transformers without incurring quadratic computational cost?
  • RQ2Do multi-scale, window-based focal mechanisms improve performance on image classification, object detection, and semantic segmentation compared to existing attention strategies?
  • RQ3How do Focal Transformer variants perform relative to state-of-the-art models across standard benchmarks?

Key findings

  • Focal Transformers outperform SoTA Vision Transformer baselines of similar size and FLOPs on ImageNet-1K classification.
  • Focal-Small and Focal-Base achieve higher Top-1 accuracy than comparable Swin and other Transformer models.
  • In object detection and instance segmentation on COCO, Focal-Tiny/Small/Base provide consistent gains over Swin Transformers across multiple detectors and schedules.
  • On ADE20K semantic segmentation, Focal-Tiny/Small/Base outperform Swin Transformers of similar size in single-scale and multi-scale settings.
  • The proposed attention mechanism enables both short-range fine-grain and long-range coarse-grain interactions with reduced computational cost compared to full attention.

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.