Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

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

About

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}.

Chun-Fu Chen, Quanfu Fan, Rameswar Panda• 2021

Related benchmarks

TaskDatasetResultRank
Image ClassificationImageNet-1K 1.0 (val)
Top-1 Accuracy81
2238
ClassificationImageNet-1K 1.0 (val)
Top-1 Accuracy (%)84.1
1171
Image ClassificationImageNet-1k (val)
Top-1 Accuracy83.9
920
Image ClassificationImageNet 1k (test)
Top-1 Accuracy82.2
880
Image ClassificationImageNet-1k (val)
Top-1 Accuracy81.5
708
Image ClassificationImageNet-1k (val)
Top-1 Acc84.1
706
Image ClassificationImageNet (val)
Top-1 Accuracy81
354
Image ClassificationCIFAR-100
Accuracy91.36
302
Image ClassificationAID (test)
Overall Accuracy80.6
223
Image ClassificationOxford-IIIT Pet
Accuracy95.07
219
Showing 10 of 30 rows

Other info

Code

Follow for update