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

MetaFormer Is Actually What You Need for Vision

About

Transformers have shown great potential in computer vision tasks. A common belief is their attention-based token mixer module contributes most to their competence. However, recent works show the attention-based module in Transformers can be replaced by spatial MLPs and the resulted models still perform quite well. Based on this observation, we hypothesize that the general architecture of the Transformers, instead of the specific token mixer module, is more essential to the model's performance. To verify this, we deliberately replace the attention module in Transformers with an embarrassingly simple spatial pooling operator to conduct only basic token mixing. Surprisingly, we observe that the derived model, termed as PoolFormer, achieves competitive performance on multiple computer vision tasks. For example, on ImageNet-1K, PoolFormer achieves 82.1% top-1 accuracy, surpassing well-tuned Vision Transformer/MLP-like baselines DeiT-B/ResMLP-B24 by 0.3%/1.1% accuracy with 35%/52% fewer parameters and 50%/62% fewer MACs. The effectiveness of PoolFormer verifies our hypothesis and urges us to initiate the concept of "MetaFormer", a general architecture abstracted from Transformers without specifying the token mixer. Based on the extensive experiments, we argue that MetaFormer is the key player in achieving superior results for recent Transformer and MLP-like models on vision tasks. This work calls for more future research dedicated to improving MetaFormer instead of focusing on the token mixer modules. Additionally, our proposed PoolFormer could serve as a starting baseline for future MetaFormer architecture design. Code is available at https://github.com/sail-sg/poolformer.

Weihao Yu, Mi Luo, Pan Zhou, Chenyang Si, Yichen Zhou, Xinchao Wang, Jiashi Feng, Shuicheng Yan• 2021

Related benchmarks

TaskDatasetResultRank
Semantic segmentationADE20K (val)
mIoU42.7
2888
Object DetectionCOCO 2017 (val)
AP41
2643
Image ClassificationImageNet-1K 1.0 (val)
Top-1 Accuracy82.5
1952
Image ClassificationImageNet-1K
Top-1 Acc77.2
1239
Instance SegmentationCOCO 2017 (val)
APm0.377
1201
Semantic segmentationADE20K
mIoU40.3
1024
Image ClassificationImageNet 1k (test)
Top-1 Accuracy82.4
848
Image ClassificationImageNet-1k (val)
Top-1 Accuracy82.5
844
Image ClassificationImageNet A
Top-1 Acc18.5
654
Image ClassificationImageNet-R
Top-1 Acc42.4
529
Showing 10 of 46 rows

Other info

Code

Follow for update