LocalViT: Analyzing Locality in Vision Transformers

By Yawei Li, Kai Zhang, Jie Cao, Radu Timofte, Luc Van Gool. 2021

448 citations recorded by the source corpus.

The aim of this paper is to study the influence of locality mechanisms in vision transformers. Transformers originated from machine translation and are particularly good at modelling long-range dependencies within a long sequence. Although the global interaction between the token embeddings could be well modelled by the self-attention mechanism of transformers, what is lacking is a locality mechanism for infor-mation exchange within a local region. In this paper, locality mechanism is systematically investigated by carefully designed controlled experiments. We add locality to vision transformers into the feed-forward network. This seemingly simple solution is inspired by the comparison between feed-forward networks and inverted residual blocks. The importance of locality mechanisms is validated in two ways: 1) A wide range of design choices (activation function, layer placement, expansion ratio) are available for incorporating locality mechanisms and proper choices can lead to a performance gain over the baseline, and 2) The same locality mechanism is successfully applied to vision transformers with different architecture designs, which shows the generalization of the locality concept. For ImageNet2012 classification, the locality-enhanced transformers outperform the baselines Swin-T [1], DeiT-T [2] and PVT-T [3] by 1.0%, 2.6 % and 3.1 % with a negligible increase in the number of parameters and computational effort. Code is available at https://github.com/ofsoundof/LocalViT.

Subfields: Computer Vision and Pattern Recognition, Electrical and Electronic Engineering, Model Architectures

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Computer Vision and Pattern Recognition

  1. Luc Van Gool
  2. Dacheng Tao
  3. Ming-Hsuan Yang
  4. Xiaogang Wang
  5. Jiashi Feng
  6. Chen Change Loy
  7. Trevor Darrell
  8. Chunhua Shen

In Electrical and Electronic Engineering

  1. Dacheng Tao
  2. Jianfeng Gao
  3. Jianwei Yang
  4. Jing Zhang
  5. Lu Yuan
  6. Yu Qiao
  7. Shiji Song
  8. Jiashi Feng

In Model Architectures

  1. Jianfeng Gao
  2. Jianwei Yang
  3. Lu Yuan
  4. Bin Xiao
  5. Jiashi Feng
  6. Luc Van Gool
  7. Fahad Shahbaz Khan
  8. Dacheng Tao

Citations in the corpus