timm documentation

ConvNeXt

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v1.0.30).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

ConvNeXt

Category: CNN Β· Code: timm/models/convnext.py Β· Architectures: 31 Β· Pretrained weights: 101 (61 with ImageNet-1k results)

ConvNeXt is a pure convolutional network that adopts design choices from vision transformers, such as large depthwise kernels, inverted bottlenecks and LayerNorm. ConvNeXt-V2 adds Global Response Normalization (GRN) and is pretrained as a fully convolutional masked autoencoder (FCMAE).

Papers

Usage

See the Quickstart for loading pretrained weights, image preprocessing and fine-tuning, and Feature Extraction for using the models as backbones.

>>> import timm
>>> model = timm.create_model('convnext_tiny.in12k_ft_in1k', pretrained=True)
>>> data_config = timm.data.resolve_model_data_config(model)

Model API support

FeatureConvNeXt
features_only=True feature mapsβœ“ (strides 4, 8, 16, 32)
forward_intermediates()βœ“
prune_intermediate_layers()βœ“
Any input size, no changes neededβœ“
set_input_size()–
dynamic_img_size=True–
set_grad_checkpointing()βœ“
Layer-wise LR decay (group_matcher())βœ“
reset_classifier()βœ“

βœ“ supported, βœ“ (square) works for square sizes only, βœ— not supported, – not needed (the model already accepts any input size). Checked by running each feature on a randomly initialized model (ConvNeXt with convnext_zepto_rms at 224), other architectures of the same class are expected to behave the same. See the Model API page for details.

Architectures

ArchitectureParams (M)GMACsInput sizePretrained weights
convnext_atto3.700.552241
convnext_atto_ols3.700.582241
convnext_atto_rms3.690.552240
convnext_base88.5915.3822416
convnext_femto5.220.792241
convnext_femto_ols5.230.822241
convnext_large197.7734.402245
convnext_large_mlp200.1370.2132010
convnext_nano15.592.462246
convnext_nano_ols15.652.652241
convnext_pico9.051.372241
convnext_pico_ols9.061.432241
convnext_small50.228.712249
convnext_tiny28.594.472249
convnext_tiny_hnf28.594.472241
convnext_xlarge350.2060.982243
convnext_xxlarge846.47198.092564
convnext_zepto_rms2.160.302241
convnext_zepto_rms_ols2.160.342241
convnextv2_atto3.710.552242
convnextv2_base88.7215.382244
convnextv2_femto5.230.792242
convnextv2_huge660.29337.963844
convnextv2_large197.9634.402244
convnextv2_nano15.622.462244
convnextv2_pico9.071.372242
convnextv2_small50.328.712240
convnextv2_tiny28.644.472244
test_convnext0.270.031601
test_convnext20.480.051601
test_convnext30.470.051601

GMACs and parameter counts are for the default input size and classifier of each architecture, from the benchmark results.

Pretrained weights

Top-1 is ImageNet-1k validation accuracy from results-imagenet.csv at the listed eval size, - if the weight has no ImageNet-1k result (e.g. pretraining or image-text weights). Classes is the size of the pretrained classifier, none for weights without one.

Weights are grouped by source: the paper or origin given in the pretrained config, else a Hub organization other than timm, else the first part of the pretrained tag (architecture.tag). Sources with a single weight are listed under other.

ConvNeXt V2

Pretrained configs reference ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders.

WeightInput sizeTop-1 (%)Eval sizeClassesLicenseHub
convnextv2_atto.fcmae224--nonecc-by-nc-4.0timm
convnextv2_atto.fcmae_ft_in1k224 (test 288)77.7942881000cc-by-nc-4.0timm
convnextv2_base.fcmae224--nonecc-by-nc-4.0timm
convnextv2_base.fcmae_ft_in1k224 (test 288)85.4902881000cc-by-nc-4.0timm
convnextv2_base.fcmae_ft_in22k_in1k224 (test 288)86.9942881000cc-by-nc-4.0timm
convnextv2_base.fcmae_ft_in22k_in1k_38438487.6383841000cc-by-nc-4.0timm
convnextv2_femto.fcmae224--nonecc-by-nc-4.0timm
convnextv2_femto.fcmae_ft_in1k224 (test 288)79.3422881000cc-by-nc-4.0timm
convnextv2_huge.fcmae224--nonecc-by-nc-4.0timm
convnextv2_huge.fcmae_ft_in1k224 (test 288)86.6182881000cc-by-nc-4.0timm
convnextv2_huge.fcmae_ft_in22k_in1k_38438488.6663841000cc-by-nc-4.0timm
convnextv2_huge.fcmae_ft_in22k_in1k_51251288.8605121000cc-by-nc-4.0timm
convnextv2_large.fcmae224--nonecc-by-nc-4.0timm
convnextv2_large.fcmae_ft_in1k224 (test 288)86.1322881000cc-by-nc-4.0timm
convnextv2_large.fcmae_ft_in22k_in1k224 (test 288)87.4942881000cc-by-nc-4.0timm
convnextv2_large.fcmae_ft_in22k_in1k_38438488.1803841000cc-by-nc-4.0timm
convnextv2_nano.fcmae224--nonecc-by-nc-4.0timm
convnextv2_nano.fcmae_ft_in1k224 (test 288)82.4902881000cc-by-nc-4.0timm
convnextv2_nano.fcmae_ft_in22k_in1k224 (test 288)82.6662881000cc-by-nc-4.0timm
convnextv2_nano.fcmae_ft_in22k_in1k_38438483.3663841000cc-by-nc-4.0timm
convnextv2_pico.fcmae224--nonecc-by-nc-4.0timm
convnextv2_pico.fcmae_ft_in1k224 (test 288)81.0622881000cc-by-nc-4.0timm
convnextv2_tiny.fcmae224--nonecc-by-nc-4.0timm
convnextv2_tiny.fcmae_ft_in1k224 (test 288)83.4782881000cc-by-nc-4.0timm
convnextv2_tiny.fcmae_ft_in22k_in1k224 (test 288)84.4282881000cc-by-nc-4.0timm
convnextv2_tiny.fcmae_ft_in22k_in1k_38438485.0983841000cc-by-nc-4.0timm

clip tags

WeightInput sizeTop-1 (%)Eval sizeClassesLicenseHub
convnext_base.clip_laion2b256--640apache-2.0timm
convnext_base.clip_laion2b_augreg256--640apache-2.0timm
convnext_base.clip_laion2b_augreg_ft_in12k256--11821apache-2.0timm
convnext_base.clip_laion2b_augreg_ft_in12k_in1k25686.3782561000apache-2.0timm
convnext_base.clip_laion2b_augreg_ft_in12k_in1k_38438487.1443841000apache-2.0timm
convnext_base.clip_laion2b_augreg_ft_in1k25686.1842561000apache-2.0timm
convnext_base.clip_laiona256--640apache-2.0timm
convnext_base.clip_laiona_320320--640apache-2.0timm
convnext_base.clip_laiona_augreg_320320--640apache-2.0timm
convnext_base.clip_laiona_augreg_ft_in1k_38438486.4903841000apache-2.0timm
convnext_large_mlp.clip_laion2b_augreg256--768apache-2.0timm
convnext_large_mlp.clip_laion2b_augreg_ft_in12k_384384--11821apache-2.0timm
convnext_large_mlp.clip_laion2b_augreg_ft_in1k25687.3442561000apache-2.0timm
convnext_large_mlp.clip_laion2b_augreg_ft_in1k_38438487.8903841000apache-2.0timm
convnext_large_mlp.clip_laion2b_ft_320320--768apache-2.0timm
convnext_large_mlp.clip_laion2b_ft_soup_320320--768apache-2.0timm
convnext_large_mlp.clip_laion2b_soup_ft_in12k_320320--11821apache-2.0timm
convnext_large_mlp.clip_laion2b_soup_ft_in12k_384384--11821apache-2.0timm
convnext_large_mlp.clip_laion2b_soup_ft_in12k_in1k_32032087.9703201000apache-2.0timm
convnext_large_mlp.clip_laion2b_soup_ft_in12k_in1k_38438488.3343841000apache-2.0timm
convnext_xxlarge.clip_laion2b_rewind256--1024apache-2.0timm
convnext_xxlarge.clip_laion2b_soup256--1024apache-2.0timm
convnext_xxlarge.clip_laion2b_soup_ft_in12k256--11821apache-2.0timm
convnext_xxlarge.clip_laion2b_soup_ft_in1k25688.6222561000apache-2.0timm

fb tags

WeightInput sizeTop-1 (%)Eval sizeClassesLicenseHub
convnext_base.fb_in1k224 (test 288)84.4662881000apache-2.0timm
convnext_base.fb_in22k224--21841apache-2.0timm
convnext_base.fb_in22k_ft_in1k224 (test 288)86.3022881000apache-2.0timm
convnext_base.fb_in22k_ft_in1k_38438486.8263841000apache-2.0timm
convnext_large.fb_in1k224 (test 288)84.8622881000apache-2.0timm
convnext_large.fb_in22k224--21841apache-2.0timm
convnext_large.fb_in22k_ft_in1k224 (test 288)87.0122881000apache-2.0timm
convnext_large.fb_in22k_ft_in1k_38438487.4563841000apache-2.0timm
convnext_small.fb_in1k224 (test 288)83.7042881000apache-2.0timm
convnext_small.fb_in22k224--21841apache-2.0timm
convnext_small.fb_in22k_ft_in1k224 (test 288)85.2762881000apache-2.0timm
convnext_small.fb_in22k_ft_in1k_38438485.7523841000apache-2.0timm
convnext_tiny.fb_in1k224 (test 288)82.6942881000apache-2.0timm
convnext_tiny.fb_in22k224--21841apache-2.0timm
convnext_tiny.fb_in22k_ft_in1k224 (test 288)78.9502881000apache-2.0timm
convnext_tiny.fb_in22k_ft_in1k_38438484.0983841000apache-2.0timm
convnext_xlarge.fb_in22k224--21841apache-2.0timm
convnext_xlarge.fb_in22k_ft_in1k224 (test 288)87.3782881000apache-2.0timm
convnext_xlarge.fb_in22k_ft_in1k_38438487.7643841000apache-2.0timm

d1 tags

WeightInput sizeTop-1 (%)Eval sizeClassesLicenseHub
convnext_femto.d1_in1k224 (test 288)78.7122881000apache-2.0timm
convnext_femto_ols.d1_in1k224 (test 288)78.9162881000apache-2.0timm
convnext_pico.d1_in1k224 (test 288)80.4262881000apache-2.0timm
convnext_pico_ols.d1_in1k224 (test 288)80.4582881000apache-2.0timm

dinov3 tags

WeightInput sizeTop-1 (%)Eval sizeClassesLicenseHub
convnext_base.dinov3_lvd1689m224--nonedinov3-licensetimm
convnext_large.dinov3_lvd1689m224--nonedinov3-licensetimm
convnext_small.dinov3_lvd1689m224--nonedinov3-licensetimm
convnext_tiny.dinov3_lvd1689m224--nonedinov3-licensetimm

eupe tags

WeightInput sizeTop-1 (%)Eval sizeClassesLicenseHub
convnext_base.eupe_lvd1689m256--nonefair-noncommercial-research-licensetimm
convnext_small.eupe_lvd1689m256--nonefair-noncommercial-research-licensetimm
convnext_tiny.eupe_lvd1689m256--nonefair-noncommercial-research-licensetimm

d1h tags

WeightInput sizeTop-1 (%)Eval sizeClassesLicenseHub
convnext_nano.d1h_in1k224 (test 288)81.4742881000apache-2.0timm
convnext_nano_ols.d1h_in1k224 (test 288)81.6122881000apache-2.0timm

ra4 tags

WeightInput sizeTop-1 (%)Eval sizeClassesLicenseHub
convnext_zepto_rms.ra4_e3600_r224_in1k22472.8202241000apache-2.0timm
convnext_zepto_rms_ols.ra4_e3600_r224_in1k22473.2342241000apache-2.0timm

Other

WeightInput sizeTop-1 (%)Eval sizeClassesLicenseHub
convnext_atto.d2_in1k224 (test 288)77.0162881000apache-2.0timm
convnext_atto_ols.a2_in1k224 (test 288)77.2202881000apache-2.0timm
convnext_nano.in12k224--11821apache-2.0timm
convnext_nano.in12k_ft_in1k224 (test 288)82.8822881000apache-2.0timm
convnext_nano.r384_ad_in12k384--11821apache-2.0timm
convnext_nano.r384_in12k384--11821apache-2.0timm
convnext_nano.r384_in12k_ft_in1k38483.3343841000apache-2.0timm
convnext_small.in12k224--11821apache-2.0timm
convnext_small.in12k_ft_in1k224 (test 288)85.3242881000apache-2.0timm
convnext_small.in12k_ft_in1k_38438486.1863841000apache-2.0timm
convnext_tiny.in12k224--11821apache-2.0timm
convnext_tiny.in12k_ft_in1k224 (test 288)84.4482881000apache-2.0timm
convnext_tiny.in12k_ft_in1k_38438485.1543841000apache-2.0timm
convnext_tiny_hnf.a2h_in1k224 (test 288)82.6082881000apache-2.0timm
test_convnext.r160_in1k16047.7741601000apache-2.0timm
test_convnext2.r160_in1k16053.5201601000apache-2.0timm
test_convnext3.r160_in1k16053.3021601000apache-2.0timm

Citation

@Article{liu2022convnet,
  author  = {Zhuang Liu and Hanzi Mao and Chao-Yuan Wu and Christoph Feichtenhofer and Trevor Darrell and Saining Xie},
  title   = {A ConvNet for the 2020s},
  journal = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
  year    = {2022},
}

@article{Woo2023ConvNeXtV2,
  title={ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders},
  author={Sanghyun Woo, Shoubhik Debnath, Ronghang Hu, Xinlei Chen, Zhuang Liu, In So Kweon and Saining Xie},
  year={2023},
  journal={arXiv preprint arXiv:2301.00808},
}
Update on GitHub