timm documentation

NFNet

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

NFNet

Category: CNN · Code: timm/models/nfnet.py · Architectures: 36 · Pretrained weights: 14 (14 with ImageNet-1k results)

Normalization-Free networks, trained without batch normalization using scaled weight standardization: NFNet (with adaptive gradient clipping), NF-RegNet and pre-activation NF-ResNet models.

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('nf_resnet50.ra2_in1k', pretrained=True)
>>> data_config = timm.data.resolve_model_data_config(model)

Model API support

FeatureNormFreeNet
features_only=True feature maps✓ (strides 2, 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 (NormFreeNet with nf_regnet_b0 at 192), 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
dm_nfnet_f071.497.211921
dm_nfnet_f1132.6317.872241
dm_nfnet_f2193.7833.762561
dm_nfnet_f3254.9268.773201
dm_nfnet_f4316.07122.143841
dm_nfnet_f5377.21170.714161
dm_nfnet_f6438.36229.704481
eca_nfnet_l024.144.352241
eca_nfnet_l141.419.622561
eca_nfnet_l256.7220.953201
eca_nfnet_l372.0432.573520
nf_ecaresnet2616.002.412240
nf_ecaresnet5025.564.212240
nf_ecaresnet10144.558.012240
nf_regnet_b08.760.371920
nf_regnet_b110.220.822561
nf_regnet_b214.310.972400
nf_regnet_b318.591.672880
nf_regnet_b430.213.293200
nf_regnet_b549.747.953840
nf_resnet2616.002.412240
nf_resnet5025.565.462561
nf_resnet10144.558.012240
nf_seresnet2617.402.412240
nf_seresnet5028.094.212240
nf_seresnet10149.338.022240
nfnet_f071.497.211920
nfnet_f1132.6317.872240
nfnet_f2193.7833.762560
nfnet_f3254.9268.773200
nfnet_f4316.07122.143840
nfnet_f5377.21170.714160
nfnet_f6438.36229.704480
nfnet_f7499.50300.084800
nfnet_l035.074.362241
test_nfnet0.380.291601

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.

dm tags

WeightInput sizeTop-1 (%)Eval sizeClassesLicenseHub
dm_nfnet_f0.dm_in1k192 (test 256)83.4682561000apache-2.0timm
dm_nfnet_f1.dm_in1k224 (test 320)84.7003201000apache-2.0timm
dm_nfnet_f2.dm_in1k256 (test 352)85.1843521000apache-2.0timm
dm_nfnet_f3.dm_in1k320 (test 416)85.6764161000apache-2.0timm
dm_nfnet_f4.dm_in1k384 (test 512)85.8385121000apache-2.0timm
dm_nfnet_f5.dm_in1k416 (test 544)86.1025441000apache-2.0timm
dm_nfnet_f6.dm_in1k448 (test 576)86.3645761000apache-2.0timm

ra2 tags

WeightInput sizeTop-1 (%)Eval sizeClassesLicenseHub
eca_nfnet_l0.ra2_in1k224 (test 288)82.5902881000apache-2.0timm
eca_nfnet_l1.ra2_in1k256 (test 320)84.0623201000apache-2.0timm
nf_regnet_b1.ra2_in1k256 (test 288)79.3682881000apache-2.0timm
nf_resnet50.ra2_in1k256 (test 288)80.6582881000apache-2.0timm
nfnet_l0.ra2_in1k224 (test 288)82.7662881000apache-2.0timm

Other

WeightInput sizeTop-1 (%)Eval sizeClassesLicenseHub
eca_nfnet_l2.ra3_in1k320 (test 384)84.7103841000apache-2.0timm
test_nfnet.r160_in1k16047.6341601000apache-2.0timm
Update on GitHub