timm documentation
LeViT
LeViT
카테고리: 하이브리드 · 코드: timm/models/levit.py · 아키텍처: 20 · 프리트레인드 가중치: 10 (ImageNet-1k 결과 포함 10개)
LeViT는 빠른 추론을 위한 하이브리드 네트워크로, 컨볼루션 스템(convolutional stem) 뒤에 이어지는 어텐션 스테이지(attention stages)가 어텐션 기반 다운샘플링(attention based downsampling)을 통해 해상도를 축소하고, 어텐션 바이어스(attention biases)를 사용하여 위치를 표현합니다.
논문
사용
사전 학습된 가중치 로드, 이미지 전처리 및 파인튜닝에 대해서는 Quickstart를, 모델을 백본으로 사용하는 방법에 대해서는 Feature Extraction을 참고하세요.
>>> 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 feature map | ✓ (strides 16, 32, 64) | ✓ (strides 16, 32, 64) |
forward_intermediates() | ✓ | ✓ |
prune_intermediate_layers() | ✓ | ✓ |
| 입력 크기 무관, 변경 불필요 | ✗ | ✗ |
set_input_size() | ✗ | ✗ |
dynamic_img_size=True | ✗ | ✗ |
set_grad_checkpointing() | ✓ | ✓ |
레이어별 LR 감쇠(group_matcher()) | ✓ | ✓ |
reset_classifier() | ✓ | ✓ |
✓ 지원됨, ✓ (정사각형) 정사각형 크기만 작동, ✗ 미지원, – 필요 없음(모델이 이미 모든 입력 크기를 허용함). 무작위로 초기화된 모델(Levit은 levit_256d를 224에서, LevitDistilled는 levit_128s를 224에서)로 각 기능을 실행하여 확인했으며, 같은 클래스의 다른 아키텍처도 동일한 동작을 하는 것으로 예상됩니다. 자세한 내용은 Model API 페이지를 참조하세요.
아키텍처
| 아키텍처 | 클래스 | 매개변수 (M) | GMAC | 입력 크기 | 사전 학습된 가중치 |
|---|---|---|---|---|---|
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}
}