opensi·si

timm/models/hiera.py ·

Hiera

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

Hiera is a hierarchical vision transformer without specialized modules (convolutions, shifted windows, relative position biases), relying on masked autoencoder (MAE) pretraining to learn spatial biases.

Papers

  • Hiera: A Hierarchical Vision Transformer without the Bells-and-Whistles
  • Window Attention is Bugged: How not to Interpolate Position Embeddings

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

Model API support

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

Architectures

Architecture Params (M) GMACs Input size Pretrained weights
hiera_base_224 51.52 9.40 224 2
hiera_base_abswin_256 51.27 12.46 256 0
hiera_base_plus_224 69.90 12.67 224 2
hiera_huge_224 672.78 124.85 224 2
hiera_large_224 213.74 40.34 224 2
hiera_small_224 35.01 6.42 224 2
hiera_small_abswin_256 34.36 8.29 256 4
hiera_tiny_224 27.91 4.91 224 2

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.

mae tags

テーブル(13 行)
Weight Input size Top-1 (%) Eval size Classes License Hub
hiera_base_224.mae 224 - - none cc-by-nc-4.0 timm
hiera_base_224.mae_in1k_ft_in1k 224 84.528 224 1000 cc-by-nc-4.0 timm
hiera_base_plus_224.mae 224 - - none cc-by-nc-4.0 timm
hiera_base_plus_224.mae_in1k_ft_in1k 224 85.136 224 1000 cc-by-nc-4.0 timm
hiera_huge_224.mae 224 - - none cc-by-nc-4.0 timm
hiera_huge_224.mae_in1k_ft_in1k 224 86.840 224 1000 cc-by-nc-4.0 timm
hiera_large_224.mae 224 - - none cc-by-nc-4.0 timm
hiera_large_224.mae_in1k_ft_in1k 224 86.046 224 1000 cc-by-nc-4.0 timm
hiera_small_224.mae 224 - - none cc-by-nc-4.0 timm
hiera_small_224.mae_in1k_ft_in1k 224 83.888 224 1000 cc-by-nc-4.0 timm
hiera_tiny_224.mae 224 - - none cc-by-nc-4.0 timm
hiera_tiny_224.mae_in1k_ft_in1k 224 82.826 224 1000 cc-by-nc-4.0 timm

sbb2 tags

Weight Input size Top-1 (%) Eval size Classes License Hub
hiera_small_abswin_256.sbb2_e200_in12k 256 - - 11821 apache-2.0 timm
hiera_small_abswin_256.sbb2_e200_in12k_ft_in1k 256 84.912 256 1000 apache-2.0 timm
hiera_small_abswin_256.sbb2_pd_e200_in12k 256 - - 11821 apache-2.0 timm
hiera_small_abswin_256.sbb2_pd_e200_in12k_ft_in1k 256 84.564 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.