timm documentation
LeViT
LeViT
Kategori: Hibrida Β· Kode: timm/models/levit.py Β· Arsitektur: 20 Β· Bobot terlatih: 10 (10 dengan hasil ImageNet-1k)
LeViT adalah jaringan hibrida untuk inferensi cepat, yang terdiri dari batang konvolusional diikuti oleh tahap-tahap perhatian yang mengurangi resolusi dengan downsampling berbasis perhatian dan menggunakan bias perhatian untuk posisi.
Makalah
Penggunaan
Lihat Quickstart untuk memuat bobot terlatih, prapemrosesan gambar, dan penyesuaian halus, serta Ekstraksi Fitur untuk menggunakan model sebagai tulang punggung.
>>> import timm
>>> model = timm.create_model('levit_256.fb_dist_in1k', pretrained=True)
>>> data_config = timm.data.resolve_model_data_config(model)Dukungan API Model
| Fitur | Levit | LevitDistilled |
|---|---|---|
feature maps features_only=True | β (strides 16, 32, 64) | β (strides 16, 32, 64) |
forward_intermediates() | β | β |
prune_intermediate_layers() | β | β |
| Ukuran input apa pun, tidak perlu perubahan | β | β |
set_input_size() | β | β |
dynamic_img_size=True | β | β |
set_grad_checkpointing() | β | β |
Penurunan LR per lapisan (group_matcher()) | β | β |
reset_classifier() | β | β |
β didukung, β (persegi) hanya berfungsi untuk ukuran persegi, β tidak didukung, β tidak diperlukan (model sudah menerima ukuran input apa pun). Diperiksa dengan menjalankan setiap fitur pada model yang diinisialisasi secara acak (Levit dengan levit_256d pada 224, LevitDistilled dengan levit_128s pada 224), arsitektur lain dari kelas yang sama diharapkan berperilaku sama. Lihat halaman Model API untuk detailnya.
Arsitektur
| Arsitektur | Kelas | Parameter (M) | GMACs | Ukuran input | Bobot terlatih |
|---|---|---|---|---|---|
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 dan jumlah parameter adalah untuk ukuran input dan klasifer default dari setiap arsitektur, dari hasil benchmark.
Bobot terlatih
Top-1 adalah akurasi validasi ImageNet-1k dari results-imagenet.csv pada ukuran eval yang tercantum, - jika bobot tidak memiliki hasil ImageNet-1k (misalnya bobot pretraining atau image-text). Classes adalah ukuran dari classifier pretrained, none untuk bobot yang tidak memilikinya.
| Bobot | Ukuran input | Top-1 (%) | Ukuran evaluasi | Kelas | Lisensi | 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 |
Sitasi
@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}
}