Adaptive Token Sampling For Efficient Vision Transformers

Mohsen Fayyaz, Soroush Abbasi Koohpayegani, Farnoush Rezaei Jafari, Sunando Sengupta, Hamid Reza Vaezi Joze +3 more
11/30/2021
cs.CV

Official code: adaptivetokensampling/ATS (105 stars, Shell, Apache-2.0, last commit 2024-05-03).

Abstract

While state-of-the-art vision transformer models achieve promising results in image classification, they are computationally expensive and require many GFLOPs. Although the GFLOPs of a vision transformer can be decreased by reducing the number of tokens in the network, there is no setting that is optimal for all input images.

Show full abstract

In this work, we therefore introduce a differentiable parameter-free Adaptive Token Sampler (ATS) module, which can be plugged into any existing vision transformer architecture. ATS empowers vision transformers by scoring and adaptively sampling significant tokens. As a result, the number of tokens is not constant anymore and varies for each input image. By integrating ATS as an additional layer within the current transformer blocks, we can convert them into much more efficient vision transformers with an adaptive number of tokens. Since ATS is a parameter-free module, it can be added to the off-the-shelf pre-trained vision transformers as a plug and play module, thus reducing their GFLOPs without any additional training. Moreover, due to its differentiable design, one can also train a vision transformer equipped with ATS. We evaluate the efficiency of our module in both image and video classification tasks by adding it to multiple SOTA vision transformers. Our proposed module improves the SOTA by reducing their computational costs (GFLOPs) by 2X, while preserving their accuracy on the ImageNet, Kinetics-400, and Kinetics-600 datasets.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Adaptive Token Sampling for Efficient Vision Transformers (ECCV 2022 Oral Presentation)

10516Shell, PythonOct 20, 20222 years agoApache-2.0
computer-visiondeeplearningeccveccv2022image-classification+2 more

Similar Papers

Cite this paper

@article{fayyaz2021adaptive,
  title  = {Adaptive Token Sampling For Efficient Vision Transformers},
  author = {Mohsen Fayyaz and Soroush Abbasi Koohpayegani and Farnoush Rezaei Jafari and Sunando Sengupta and Hamid Reza Vaezi Joze and Eric Sommerlade and Hamed Pirsiavash and Juergen Gall},
  year   = {2021},
  eprint = {2111.15667},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2111.15667}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2111.15667.svg)](https://codeofpaper.com/paper/2111.15667)

Discussion