timm documentation
LeViT
はじめに
チュートリアル
timmのモデルAPIモデルの適応とエクスポート事前学習モデルを特徴抽出器として使用ハイパーパラメータ (HParams)公式トレーニングスクリプトの使用🤗 Hugging Face Hub からモデルを共有して読み込む
モデルページ
モデルファミリー結果
畳み込みネットワーク
Vision Transformers
ハイブリッドな畳み込み / 注意機構ネットワーク
BYOANet(BoTNet、HaloNet、LambdaNet)CoaTCSATv2FocalNetハイブリッドビジョントランスフォーマーLeViTMaxViTとCoAtNetMetaFormer(PoolFormer、ConvFormer、CAFormer)Next-ViTTinyViTVisformerViTamin
効率的なモバイルネットワーク
MLPおよびその他のトークンミキサー
マルチモーダルモデルのビジョンエンコーダー
リファレンス
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).
LeViT
カテゴリ: ハイブリッド · コード: timm/models/levit.py · アーキテクチャ: 20 · 事前学習済み重み: 10 (ImageNet-1kの結果付き10)
LeViTは高速推論のためのハイブリッドネットワークであり、畳み込みステムの後に、アテンションベースのダウンサンプリングによって解像度を縮小し、位置にはアテンションバイアスを用いるアテンションステージが続きます。
論文
使用方法
事前学習済み重みの読み込み、画像の前処理、ファインチューニングについてはクイックスタートを、モデルをバックボーンとして使用する方法については特徴量抽出を参照してください。
>>> import timm
>>> model = timm.create_model('levit_256.fb_dist_in1k', pretrained=True)
>>> data_config = timm.data.resolve_model_data_config(model)モデルAPIのサポート
| 機能 | Levit | LevitDistilled |
|---|---|---|
features_only=True 特徴マップ | ✓ (ストライド 16, 32, 64) | ✓ (ストライド 16, 32, 64) |
forward_intermediates() | ✓ | ✓ |
prune_intermediate_layers() | ✓ | ✓ |
| 入力サイズは任意で、変更は不要です | ✗ | ✗ |
set_input_size() | ✗ | ✗ |
dynamic_img_size=True | ✗ | ✗ |
set_grad_checkpointing() | ✓ | ✓ |
レイヤーごとのLR減衰(group_matcher()) | ✓ | ✓ |
reset_classifier() | ✓ | ✓ |
✓ 対応、✓ (square) 正方形サイズのみ動作、✗ 非対応、– 不要(モデルはすでに任意の入力サイズを受け入れる)。各機能をランダム初期化されたモデル(224のLevitとlevit_256d、224のLevitDistilledとlevit_128s)で実行して確認しました。同じクラスの他のアーキテクチャも同様に動作すると予想されます。詳細はModel APIページを参照してください。
アーキテクチャ
| アーキテクチャ | クラス | パラメータ数 (M) | GMACs | 入力サイズ | 事前学習済み重み |
|---|---|---|---|---|---|
levit_128 | LevitDistilled | 9.19 | 0.41 | 224 | 1 |
levit_128s | LevitDistilled | 7.76 | 0.30 | 224 | 1 |
levit_192 | LevitDistilled | 10.92 | 0.66 | 224 | 1 |
levit_256 | LevitDistilled | 18.86 | 1.13 | 224 | 1 |
levit_256d | Levit | 26.16 | 1.39 | 224 | 0 |
levit_384 | LevitDistilled | 39.07 | 2.35 | 224 | 1 |
levit_384_s8 | LevitDistilled | 39.06 | 9.95 | 224 | 0 |
levit_512 | Levit | 95.08 | 5.62 | 224 | 0 |
levit_512_s8 | Levit | 73.97 | 21.77 | 224 | 0 |
levit_512d | Levit | 92.39 | 5.84 | 224 | 0 |
levit_conv_128 | LevitDistilled | 9.19 | 0.41 | 224 | 1 |
levit_conv_128s | LevitDistilled | 7.76 | 0.30 | 224 | 1 |
levit_conv_192 | LevitDistilled | 10.92 | 0.66 | 224 | 1 |
levit_conv_256 | LevitDistilled | 18.86 | 1.13 | 224 | 1 |
levit_conv_256d | Levit | 26.16 | 1.39 | 224 | 0 |
levit_conv_384 | LevitDistilled | 39.07 | 2.35 | 224 | 1 |
levit_conv_384_s8 | LevitDistilled | 39.06 | 9.95 | 224 | 0 |
levit_conv_512 | Levit | 95.08 | 5.62 | 224 | 0 |
levit_conv_512_s8 | Levit | 73.97 | 21.77 | 224 | 0 |
levit_conv_512d | Levit | 92.39 | 5.84 | 224 | 0 |
GMACsとパラメータ数は、各アーキテクチャのデフォルトの入力サイズと分類器に基づいており、ベンチマーク結果から得られたものです。
事前学習済み重み
Top-1 は、results-imagenet.csv に記載された評価サイズでの ImageNet-1k 検証精度です。- は、ImageNet-1k の結果がない重み(例: プリトレーニング用または画像-テキスト用重み)を示します。Classes は事前学習済み分類器のサイズで、分類器を持たない重みについては none です。
| 重み | 入力サイズ | Top-1 (%) | 評価サイズ | クラス | ライセンス | Hub |
|---|---|---|---|---|---|---|
levit_128.fb_dist_in1k | 224 | 78.486 | 224 | 1000 | apache-2.0 | timm |
levit_128s.fb_dist_in1k | 224 | 76.520 | 224 | 1000 | apache-2.0 | timm |
levit_192.fb_dist_in1k | 224 | 79.858 | 224 | 1000 | apache-2.0 | timm |
levit_256.fb_dist_in1k | 224 | 81.506 | 224 | 1000 | apache-2.0 | timm |
levit_384.fb_dist_in1k | 224 | 82.600 | 224 | 1000 | apache-2.0 | timm |
levit_conv_128.fb_dist_in1k | 224 | 78.488 | 224 | 1000 | apache-2.0 | timm |
levit_conv_128s.fb_dist_in1k | 224 | 76.534 | 224 | 1000 | apache-2.0 | timm |
levit_conv_192.fb_dist_in1k | 224 | 79.860 | 224 | 1000 | apache-2.0 | timm |
levit_conv_256.fb_dist_in1k | 224 | 81.506 | 224 | 1000 | apache-2.0 | timm |
levit_conv_384.fb_dist_in1k | 224 | 82.600 | 224 | 1000 | apache-2.0 | timm |
引用
@article{graham2021levit,
title={LeViT: a Vision Transformer in ConvNet's Clothing for Faster Inference},
author={Benjamin Graham and Alaaeldin El-Nouby and Hugo Touvron and Pierre Stock and Armand Joulin and Herv'e J'egou and Matthijs Douze},
journal={arXiv preprint arXiv:2104.01136},
year={2021}
}