opensi·si

timm/models/byoanet.py ·

BYOANet (BoTNet, HaloNet, LambdaNet)

Category: Hybrid · Code: timm/models/byoanet.py · Architectures: 15 · Pretrained weights: 13 (13 with ImageNet-1k results)

Networks built with the ByobNet block / stage config system that place self-attention (or similar) layers in ResNet style stages: Bottleneck Transformers (BoTNet), HaloNets and Lambda ResNets. The module docstring marks these definitions as experimental.

Papers

  • Bottleneck Transformers for Visual Recognition
  • LambdaNetworks: Modeling Long-Range Interactions Without Attention
  • Scaling Local Self-Attention for Parameter Efficient Visual Backbones

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

Model API support

Feature ByobNet
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 (ByobNet with halonet_h1 at 256), other architectures of the same class are expected to behave the same. See the Model API page for details.

Architectures

표 (16행)
Architecture Params (M) GMACs Input size Pretrained weights
botnet26t_256 12.49 3.32 256 1
botnet50ts_256 22.74 5.54 256 0
eca_botnext26ts_256 10.59 2.46 256 1
eca_halonext26ts 10.76 2.44 256 1
halo2botnet50ts_256 22.64 5.02 256 1
halonet26t 12.48 3.19 256 1
halonet50ts 22.73 5.30 256 1
halonet_h1 8.10 3.00 256 0
haloregnetz_b 11.68 1.97 224 1
lambda_resnet26rpt_256 10.99 3.16 256 1
lambda_resnet26t 10.96 3.02 256 1
lambda_resnet50ts 21.54 5.07 256 1
lamhalobotnet50ts_256 22.57 5.02 256 1
sebotnet33ts_256 13.70 3.89 256 1
sehalonet33ts 13.69 3.55 256 1

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.

a1h tags

Weight Input size Top-1 (%) Eval size Classes License Hub
halo2botnet50ts_256.a1h_in1k 256 82.084 256 1000 apache-2.0 timm
halonet26t.a1h_in1k 256 79.134 256 1000 apache-2.0 timm
halonet50ts.a1h_in1k 256 81.640 256 1000 apache-2.0 timm
lambda_resnet50ts.a1h_in1k 256 81.184 256 1000 apache-2.0 timm
lamhalobotnet50ts_256.a1h_in1k 256 81.552 256 1000 apache-2.0 timm
sebotnet33ts_256.a1h_in1k 256 81.156 256 1000 apache-2.0 timm

c1 tags

Weight Input size Top-1 (%) Eval size Classes License Hub
botnet26t_256.c1_in1k 256 79.256 256 1000 apache-2.0 timm
eca_botnext26ts_256.c1_in1k 256 79.262 256 1000 apache-2.0 timm
eca_halonext26ts.c1_in1k 256 79.518 256 1000 apache-2.0 timm
lambda_resnet26rpt_256.c1_in1k 256 78.960 256 1000 apache-2.0 timm
lambda_resnet26t.c1_in1k 256 79.126 256 1000 apache-2.0 timm

Other

Weight Input size Top-1 (%) Eval size Classes License Hub
haloregnetz_b.ra3_in1k 224 81.058 224 1000 apache-2.0 timm
sehalonet33ts.ra2_in1k 256 80.976 256 1000 apache-2.0 timm

Source and license

Source: timm documentation, adapted for this site. Licensing and attribution follow the terms of the upstream project.