timm documentation

CoaT

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

CoaT

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

Co-Scale Conv-Attentional Image Transformers (CoaT) use factorized attention with convolution based relative position encodings, and a co-scale mechanism that exchanges information between parallel blocks at different scales.

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

Model API support

FeatureCoaT
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 (CoaT with coat_tiny 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
coat_lite_medium44.579.812241
coat_lite_medium_38444.5728.733841
coat_lite_mini11.012.002241
coat_lite_small19.843.962241
coat_lite_tiny5.721.602241
coat_mini10.346.822241
coat_small21.6912.612241
coat_tiny5.504.352241

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.

WeightInput sizeTop-1 (%)Eval sizeClassesLicenseHub
coat_lite_medium.in1k22483.6022241000apache-2.0timm
coat_lite_medium_384.in1k38484.8903841000apache-2.0timm
coat_lite_mini.in1k22479.1042241000apache-2.0timm
coat_lite_small.in1k22482.3042241000apache-2.0timm
coat_lite_tiny.in1k22477.5482241000apache-2.0timm
coat_mini.in1k22481.3202241000apache-2.0timm
coat_small.in1k22482.3782241000apache-2.0timm
coat_tiny.in1k22478.4422241000apache-2.0timm
Update on GitHub