CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classification

Chun-Fu Chen, Quanfu Fan, Rameswar Panda
3/27/2021
cs.CV

Official code: IBM/CrossViT (417 stars, Apache-2.0, last commit 2022-01-12).

Abstract

The recently developed vision transformer (ViT) has achieved promising results on image classification compared to convolutional neural networks. Inspired by this, in this paper, we study how to learn multi-scale feature representations in transformer models for image classification. To this end, we propose a dual-branch transformer to combine image patches (i.e., tokens in a transformer) of different sizes to produce stronger image features. Our approach processes small-patch and large-patch tokens with two separate branches of different computational complexity and these tokens are then fused purely by attention multiple times to complement each other. Furthermore, to reduce computation, we develop a simple yet effective token fusion module based on cross attention, which uses a single token for each branch as a query to exchange information with other branches. Our proposed cross-attention only requires linear time for both computational and memory complexity instead of quadratic time otherwise. Extensive experiments demonstrate that our approach performs better than or on par with several concurrent works on vision transformer, in addition to efficient CNN models. For example, on the ImageNet1K dataset, with some architectural changes, our approach outperforms the recent DeiT by a large margin of 2\% with a small to moderate increase in FLOPs and model parameters. Our source codes and models are available at \url{https://github.com/IBM/CrossViT}.

View on arXivView PDF

Code Implementations(1)

IBM/CrossViTOfficial100%
Apache-2.0

Official implementation of CrossViT. https://arxiv.org/abs/2103.14899

41756PythonJul 30, 20214 years agoApache-2.0
computer-visiondeep-learningmulti-scale-featuresvision-transformer

Similar Papers

Cite this paper

@article{chen2021crossvit,
  title  = {CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classification},
  author = {Chun-Fu Chen and Quanfu Fan and Rameswar Panda},
  year   = {2021},
  eprint = {2103.14899},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2103.14899}
}

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/2103.14899.svg)](https://codeofpaper.com/paper/2103.14899)

Discussion