Instructions to use NCPS/progresvit-deit-s-192-240-imagenet1k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- timm
How to use NCPS/progresvit-deit-s-192-240-imagenet1k with timm:
import timm model = timm.create_model("hf_hub:NCPS/progresvit-deit-s-192-240-imagenet1k", pretrained=True) - Notebooks
- Google Colab
- Kaggle
Add direct timm loading
Browse files- README.md +36 -7
- config.json +43 -0
- model.safetensors +3 -0
README.md
CHANGED
|
@@ -1,38 +1,67 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
| 3 |
pipeline_tag: image-classification
|
| 4 |
tags:
|
| 5 |
- image-classification
|
| 6 |
- vision-transformer
|
|
|
|
| 7 |
- imagenet-1k
|
| 8 |
- progresvit
|
|
|
|
| 9 |
datasets:
|
| 10 |
- ILSVRC/imagenet-1k
|
|
|
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
# ProgResViT DeiT-S (192 → 240)
|
| 14 |
|
| 15 |
-
EMA
|
| 16 |
|
| 17 |
-
- Paper: [
|
|
|
|
| 18 |
- Code: [ds-kiel/ProgResViT](https://github.com/ds-kiel/ProgResViT)
|
| 19 |
-
|
| 20 |
- Training: standard
|
| 21 |
-
-
|
| 22 |
- Full-path compute: 6.267 GMACs
|
| 23 |
|
| 24 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
```python
|
| 27 |
from huggingface_hub import hf_hub_download
|
| 28 |
|
| 29 |
-
|
| 30 |
repo_id="NCPS/progresvit-deit-s-192-240-imagenet1k",
|
| 31 |
filename="progresvit_192_240.pth.tar",
|
|
|
|
| 32 |
)
|
| 33 |
```
|
| 34 |
|
| 35 |
-
|
| 36 |
|
| 37 |
```bash
|
| 38 |
python validate.py /path/to/imagenet/val \
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
library_name: timm
|
| 4 |
pipeline_tag: image-classification
|
| 5 |
tags:
|
| 6 |
- image-classification
|
| 7 |
- vision-transformer
|
| 8 |
+
- adaptive-inference
|
| 9 |
- imagenet-1k
|
| 10 |
- progresvit
|
| 11 |
+
- arxiv:2609.03216
|
| 12 |
datasets:
|
| 13 |
- ILSVRC/imagenet-1k
|
| 14 |
+
metrics:
|
| 15 |
+
- accuracy
|
| 16 |
---
|
| 17 |
|
| 18 |
# ProgResViT DeiT-S (192 → 240)
|
| 19 |
|
| 20 |
+
ImageNet-1K EMA weights for **ProgResViT DeiT-S (192 → 240)** from [ProgResViT: Progressive Resolution and Width for Adaptive Vision Transformers](https://arxiv.org/abs/2609.03216).
|
| 21 |
|
| 22 |
+
- Paper: [arXiv:2609.03216](https://arxiv.org/abs/2609.03216)
|
| 23 |
+
- Hugging Face paper: [2609.03216](https://huggingface.co/papers/2609.03216)
|
| 24 |
- Code: [ds-kiel/ProgResViT](https://github.com/ds-kiel/ProgResViT)
|
|
|
|
| 25 |
- Training: standard
|
| 26 |
+
- Full-path top-1 accuracy: 82.206%
|
| 27 |
- Full-path compute: 6.267 GMACs
|
| 28 |
|
| 29 |
+
## Usage
|
| 30 |
+
|
| 31 |
+
Run from the cloned ProgResViT repository root, or add the repository to `PYTHONPATH`:
|
| 32 |
+
|
| 33 |
+
```python
|
| 34 |
+
import torch
|
| 35 |
+
from timm.models import create_model
|
| 36 |
+
|
| 37 |
+
model = create_model("hf-hub:NCPS/progresvit-deit-s-192-240-imagenet1k", pretrained=True)
|
| 38 |
+
model.eval()
|
| 39 |
+
|
| 40 |
+
x = torch.randn(1, 3, 240, 240)
|
| 41 |
+
with torch.inference_mode():
|
| 42 |
+
logits, stage = model(x, threshold=0.35)
|
| 43 |
+
|
| 44 |
+
print(logits.shape) # (1, 1000)
|
| 45 |
+
print(stage) # 0 = 192 px / 3 heads; 1 = 240 px / 6 heads
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
The entropy threshold controls routing. Lower values send more images to the second round; higher values exit more images after the first round.
|
| 49 |
+
|
| 50 |
+
## ImageNet-1K validation
|
| 51 |
+
|
| 52 |
+
Download the release checkpoint into `checkpoints/`:
|
| 53 |
|
| 54 |
```python
|
| 55 |
from huggingface_hub import hf_hub_download
|
| 56 |
|
| 57 |
+
hf_hub_download(
|
| 58 |
repo_id="NCPS/progresvit-deit-s-192-240-imagenet1k",
|
| 59 |
filename="progresvit_192_240.pth.tar",
|
| 60 |
+
local_dir="checkpoints",
|
| 61 |
)
|
| 62 |
```
|
| 63 |
|
| 64 |
+
Then run the repository evaluator:
|
| 65 |
|
| 66 |
```bash
|
| 67 |
python validate.py /path/to/imagenet/val \
|
config.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architecture": "progresvit",
|
| 3 |
+
"num_classes": 1000,
|
| 4 |
+
"num_features": 384,
|
| 5 |
+
"global_pool": "token",
|
| 6 |
+
"model_args": {
|
| 7 |
+
"img_size": 240,
|
| 8 |
+
"progress_stages": [
|
| 9 |
+
3,
|
| 10 |
+
6
|
| 11 |
+
],
|
| 12 |
+
"progress_img_sizes": [
|
| 13 |
+
192,
|
| 14 |
+
240
|
| 15 |
+
]
|
| 16 |
+
},
|
| 17 |
+
"pretrained_cfg": {
|
| 18 |
+
"custom_load": false,
|
| 19 |
+
"input_size": [
|
| 20 |
+
3,
|
| 21 |
+
240,
|
| 22 |
+
240
|
| 23 |
+
],
|
| 24 |
+
"fixed_input_size": true,
|
| 25 |
+
"interpolation": "bicubic",
|
| 26 |
+
"crop_pct": 0.9,
|
| 27 |
+
"crop_mode": "center",
|
| 28 |
+
"mean": [
|
| 29 |
+
0.485,
|
| 30 |
+
0.456,
|
| 31 |
+
0.406
|
| 32 |
+
],
|
| 33 |
+
"std": [
|
| 34 |
+
0.229,
|
| 35 |
+
0.224,
|
| 36 |
+
0.225
|
| 37 |
+
],
|
| 38 |
+
"num_classes": 1000,
|
| 39 |
+
"pool_size": null,
|
| 40 |
+
"first_conv": "patch_embed.proj",
|
| 41 |
+
"classifier": "head"
|
| 42 |
+
}
|
| 43 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ac2424b4075474c62e814fecf32c571b86636721df59bdf1a24fd2631c9cfa7e
|
| 3 |
+
size 98958112
|