dqshuai / MetaFormer

A PyTorch implementation of "MetaFormer: A Unified Meta Framework for Fine-Grained Recognition". A reference PyTorch implementation of “CoAtNet: Marrying Convolution and Attention for All Data Sizes”
MIT License
216 stars 36 forks source link
fine-grained-classification pytorch

PWC PWC PWC PWC

MetaFormer

A repository for the code used to create and train the model defined in “MetaFormer: A Unified Meta Framework for Fine-Grained Recognition” arxiv:2203.02751 Image text Moreover, MetaFormer is similar to CoAtNet. Therefore, this repo can also be seen as a reference PyTorch implementation of “CoAtNet: Marrying Convolution and Attention for All Data Sizes” arxiv:2106.04803 Image text

Model zoo

name resolution 1k model 21k model iNat21 model
MetaFormer-0 224x224 metafg_0_1k_224 metafg_0_21k_224 -
MetaFormer-1 224x224 metafg_1_1k_224 metafg_1_21k_224 -
MetaFormer-2 224x224 metafg_2_1k_224 metafg_2_21k_224 -
MetaFormer-0 384x384 metafg_0_1k_384 metafg_0_21k_384 metafg_0_inat21_384
MetaFormer-1 384x384 metafg_1_1k_384 metafg_1_21k_384 metafg_1_inat21_384
MetaFormer-2 384x384 metafg_2_1k_384 metafg_2_21k_384 metafg_2_inat21_384

You can also get model by https://pan.baidu.com/s/1ZGEDoWWU7Z0vx0VCjEbe6g (password:3uiq).

Usage

python module

Results in iNaturalist 2019, iNaturalist 2018, and iNaturalist 2021 with meta-information. Name Pretrain Meta added iNat2017 iNat2018 iNat2021
MetaFormer-0 ImageNet-1k N 75.7 79.5 88.4
MetaFormer-0 ImageNet-1k Y 79.8(+4.1) 85.4(+5.9) 92.6(+4.2)
MetaFormer-1 ImageNet-1k N 78.2 81.9 90.2
MetaFormer-1 ImageNet-1k Y 81.3(+3.1) 86.5(+4.6) 93.4(+3.2)
MetaFormer-2 ImageNet-1k N 79.0 82.6 89.8
MetaFormer-2 ImageNet-1k Y 82.0(+3.0) 86.8(+4.2) 93.2(+3.4)
MetaFormer-2 ImageNet-21k N 80.4 84.3 90.3
MetaFormer-2 ImageNet-21k Y 83.4(+3.0) 88.7(+4.4) 93.6(+3.3)

Citation

@article{MetaFormer,
  title={MetaFormer: A Unified Meta Framework for Fine-Grained Recognition},
  author={Diao, Qishuai and Jiang, Yi and Wen, Bin and Sun, Jia and Yuan, Zehuan},
  journal={arXiv preprint arXiv:2203.02751},
  year={2022},
}

Acknowledgement

Many thanks for swin-transformer.A part of the code is borrowed from it.