Home model card (LisTAya style): overview, loading, results, citation
Browse files
README.md
CHANGED
|
@@ -1,70 +1,153 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
Files are grouped by experiment line, flat inside each group, named
|
| 14 |
-
`<dataset>_<model>_<method>_<serial>.pth`. The serial is the wandb serial, and the name ends in it
|
| 15 |
-
because only the last epoch is kept, so "last" is implied and never written into the name.
|
| 16 |
-
|
| 17 |
-
| Group | Origin | wandb project | Serials | Backbone | Files |
|
| 18 |
-
|---|---|---|---|---|---|
|
| 19 |
-
| `ila_main_224` | ILA/SAW paper | ILA | 1 | vit_b16 | 206 |
|
| 20 |
-
| `ila_main_448` | ILA/SAW paper | ILA | 3 | vit_b16 | 185 |
|
| 21 |
-
| `ila_ablations` | ILA/SAW paper | ILA | 4–18 | vit_b16 | 33 |
|
| 22 |
-
| `ila_saw` | ILA/SAW paper | ILA | 90–93, 210–260 | vit_b16 | 36 |
|
| 23 |
-
| `ila_saw_deit` | ILA/SAW paper | ILA | 71, 81 | pedeit_base_patch16_224.fb_in1k | 20 |
|
| 24 |
-
| `ila_saw_no_ila` | ILA/SAW paper | ILA | 270–272 | vit_b16 | 21 |
|
| 25 |
-
| `ila_swin` | ILA/SAW paper | ILA | 80, 81, 161 | peswin_base_patch4_window7_224.ms_in22k | 31 |
|
| 26 |
-
| `ila_dinov2` | ILA/SAW paper | ILA | 27, 70, 71 | pevit_base_patch14_dinov2.lvd142m | 9 |
|
| 27 |
-
| `ila_foundation` | ILA/SAW paper | ila-backbones-baselines | 100/200/300 | MAE, DINOv2, CLIP pevit | 6 |
|
| 28 |
-
| `ila_equal_compute` | ILA/SAW paper | ILA | 150 | vit_b16 | 10 |
|
| 29 |
-
| `aaa_main_224` | AAA paper | ILA | 401 | vit_b16 | 13 |
|
| 30 |
-
| `aaa_main_448` | AAA paper | ILA | 403 | vit_b16 | 15 |
|
| 31 |
-
| `aaa_main_672` | AAA paper | AAA | 501 | vit_b16 | 40 |
|
| 32 |
-
| `aaa_fungi` | AAA paper (breadth) | AAA | 561 | vit_b16 | 3 |
|
| 33 |
-
| `medical_idrid` | AAA medical | AAA | 541 | vit_b16 | 6 |
|
| 34 |
-
| `medical_petl` | AAA medical | AAA | 1 | vit_b16 | 55 |
|
| 35 |
-
| `ft_224` | FGIR benchmark | FGIRFT | 1 | vit_b16 | 111 |
|
| 36 |
-
| `ft_448` | FGIR benchmark | FGIRFT | 3 | vit_b16 | 131 |
|
| 37 |
-
|
| 38 |
-
The wandb project shown is the current one. Some older configs carry a legacy `project_name` in
|
| 39 |
-
their embedded config (`MLA` for the ILA main tables, `PEFGIR` for part of the 224 benchmark);
|
| 40 |
-
grouping here follows the experiment line, not that field.
|
| 41 |
-
|
| 42 |
-
`aaa_main_672` holds the four adapter arms (attention-aggregation, ILA++ conv, plain adapter,
|
| 43 |
-
frozen) across ten datasets. `ila_foundation` holds the frozen MAE/DINOv2/CLIP baselines
|
| 44 |
-
(launched as serials 100/200/300, renumbered to 29). The AAA finals (`aaa_main_224`/`448`) carry
|
| 45 |
-
`save_images`, so attention visualisations are produced from the method itself. `aaa_fungi` is the
|
| 46 |
-
FungiTastic-FewShot breadth probe (the AAA arm only, one seed, all three resolutions under serial
|
| 47 |
-
561, the resolution kept in the `_is224/448/672` suffix); it is not printed in the paper — on fungi
|
| 48 |
-
the plain adapter beats AAA.
|
| 49 |
-
|
| 50 |
-
## Contents of a checkpoint
|
| 51 |
-
|
| 52 |
-
Each file is a dict with `config` (the run's full argument namespace), `model` (the state dict),
|
| 53 |
-
`accuracy` (top-1 on the test set) and `epoch`. Load it with `torch.load(path,
|
| 54 |
-
weights_only=False)`; the embedded `config` drives model construction.
|
| 55 |
-
|
| 56 |
-
## Loading by name
|
| 57 |
-
|
| 58 |
-
Install the standalone library and load any checkpoint by its `<group>/<stem>` name — no
|
| 59 |
-
`fgir_vit` install needed:
|
| 60 |
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
pip install git+https://github.com/arkel23/fgir-zoo.git
|
| 63 |
-
python -c "import fgir_zoo; m = fgir_zoo.load('fgirvit/aaa_main_448/soylocal_vit_b16_aaa_dso_cls_adapter_fz_403')"
|
| 64 |
```
|
| 65 |
|
| 66 |
-
`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
|
| 68 |
-
The
|
| 69 |
-
|
| 70 |
-
`create_model` refuses them rather than loading loosely.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pipeline_tag: image-classification
|
| 3 |
+
library_name: fgir-zoo
|
| 4 |
+
tags:
|
| 5 |
+
- fine-grained
|
| 6 |
+
- ultra-fine-grained
|
| 7 |
+
- image-classification
|
| 8 |
+
- vision-transformer
|
| 9 |
+
- parameter-efficient
|
| 10 |
+
- adapter
|
| 11 |
+
- petl
|
| 12 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
+
# FGIR-ViT
|
| 15 |
+
|
| 16 |
+
Vision-transformer checkpoints for **ultra-fine-grained image recognition (UFGIR)** — telling apart
|
| 17 |
+
cultivars *within* a species (soybean, cotton and other leaf sets) where classes differ by tiny
|
| 18 |
+
visual margins and samples per class are scarce. Every checkpoint is an ImageNet-21k **ViT-B/16 with
|
| 19 |
+
the backbone frozen**; only a small set of adapter modules is trained, so a model is a ~340 MB file
|
| 20 |
+
of which ~2 M parameters were actually learned.
|
| 21 |
+
|
| 22 |
+
The repository gathers the checkpoints behind three lines of work from the ERIS Lab:
|
| 23 |
+
|
| 24 |
+
- **ILA** — the down-sampling inter-layer adapter, and **SAW**, a semantic-adaptation warmup added on
|
| 25 |
+
top of it (the `ila_*` groups). ILA was introduced in the ECCV 2024 EFM workshop paper below.
|
| 26 |
+
- **AAA** — the attention-aggregation adapter, which replaces ILA's convolutional down-sampler with a
|
| 27 |
+
bottleneck attention that fixes the adapter's misplaced attention (the `aaa_*` groups).
|
| 28 |
+
- **FGIRFT** — a full fine-tuning FGIR benchmark on 21 datasets, for reference (the `ft_*` groups).
|
| 29 |
+
|
| 30 |
+
931 checkpoints, one seed per configuration, last epoch only. Everything is described in
|
| 31 |
+
`manifest.csv` and loadable by name with the standalone `fgir_zoo` library (no training repo needed).
|
| 32 |
+
|
| 33 |
+
## Training recipe
|
| 34 |
+
|
| 35 |
+
Backbone `vit_b16` (ImageNet-21k), frozen. The trainable part is the adapter family named in the
|
| 36 |
+
filename (a plain PETL adapter, ILA's down-sampling adapter, or the AAA attention-aggregation
|
| 37 |
+
adapter); the SAW runs add a supervised-contrastive warmup stage before the classifier is trained.
|
| 38 |
+
Images are ImageNet-normalized and evaluated at 224, 448 or 672 px. Each embedded `config` (an
|
| 39 |
+
argparse namespace saved in the checkpoint) records the exact settings.
|
| 40 |
+
|
| 41 |
+
## What each folder holds
|
| 42 |
+
|
| 43 |
+
Files are grouped by experiment line and named `<dataset>_<model>_<method>_<serial>[_<variant>].pth`;
|
| 44 |
+
the trailing number is the run's wandb serial, and the name ends in it because only the last epoch is
|
| 45 |
+
kept (so "last" is implied). `<variant>` is a resolution tag (`_is224/448/672`) where one serial
|
| 46 |
+
spans several resolutions.
|
| 47 |
+
|
| 48 |
+
| Group | Line / paper | Backbone | What it is |
|
| 49 |
+
|---|---|---|---|
|
| 50 |
+
| `ila_main_224` / `ila_main_448` | ILA/SAW | vit_b16 | Main UFGIR comparison of ILA against PETL and FGIR baselines, at 224 / 448 |
|
| 51 |
+
| `ila_ablations` | ILA/SAW | vit_b16 | ILA design ablations |
|
| 52 |
+
| `ila_saw`, `ila_saw_deit`, `ila_saw_no_ila` | ILA/SAW | vit_b16 / pedeit | The SAW contrastive-warmup runs |
|
| 53 |
+
| `ila_swin`, `ila_dinov2`, `ila_foundation` | ILA/SAW | peswin / pevit | ILA on other backbones and frozen foundation baselines |
|
| 54 |
+
| `ila_equal_compute` | ILA/SAW | vit_b16 | Equal-compute control |
|
| 55 |
+
| `aaa_main_224` / `aaa_main_448` / `aaa_main_672` | AAA | vit_b16 | The AAA finals (frozen / adapter / ILA++ / AAA arms), by resolution |
|
| 56 |
+
| `aaa_fungi` | AAA (breadth) | vit_b16 | FungiTastic breadth probe — kept for completeness, not a paper result |
|
| 57 |
+
| `medical_idrid`, `medical_petl` | AAA (medical) | vit_b16 | Medical-imaging PETL and IDRiD resolution runs |
|
| 58 |
+
| `ft_224` / `ft_448` | FGIRFT | vit_b16 | Full fine-tunes with FGIR heads (GLSim, MAWS, PSM, CAL, MPNCOV, …) on 21 datasets |
|
| 59 |
+
|
| 60 |
+
The ILA/SAW paper evaluates the `ila_main` and `ila_saw` serials; the AAA paper evaluates the
|
| 61 |
+
`aaa_main_*` serials. `manifest.csv` maps every file to its dataset, method, serial, resolution,
|
| 62 |
+
`num_classes`, top-1 accuracy and sha256.
|
| 63 |
+
|
| 64 |
+
## Load a checkpoint
|
| 65 |
+
|
| 66 |
+
Standalone, no `fgir_vit` install — the model code is vendored inside `fgir_zoo`:
|
| 67 |
+
|
| 68 |
+
```bash
|
| 69 |
pip install git+https://github.com/arkel23/fgir-zoo.git
|
|
|
|
| 70 |
```
|
| 71 |
|
| 72 |
+
```python
|
| 73 |
+
import fgir_zoo
|
| 74 |
+
model = fgir_zoo.load('fgirvit/aaa_main_448/soylocal_vit_b16_aaa_dso_cls_adapter_fz_403')
|
| 75 |
+
model.eval()
|
| 76 |
+
# fgir_zoo.list_models(family='fgirvit') lists every name; model.config holds the run's settings.
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
Or fetch the file directly and load it yourself:
|
| 80 |
+
|
| 81 |
+
```python
|
| 82 |
+
import torch, torchvision.transforms as T
|
| 83 |
+
from PIL import Image
|
| 84 |
+
from huggingface_hub import hf_hub_download
|
| 85 |
+
|
| 86 |
+
path = hf_hub_download('ERISLab/FGIR-ViT',
|
| 87 |
+
'aaa_main_448/soylocal_vit_b16_aaa_dso_cls_adapter_fz_403.pth')
|
| 88 |
+
ckpt = torch.load(path, map_location='cpu', weights_only=False) # dict: config, model, accuracy, epoch
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
A real forward on one SoyLocal test image, with the model loaded above (ImageNet-normalized,
|
| 92 |
+
448 px):
|
| 93 |
+
|
| 94 |
+
```python
|
| 95 |
+
tf = T.Compose([T.Resize(600), T.CenterCrop(448), T.ToTensor(), # config.test_resize_size = 600
|
| 96 |
+
T.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])])
|
| 97 |
+
x = tf(Image.open('soylocal/soybean200_square/1_2_test.png').convert('RGB')).unsqueeze(0)
|
| 98 |
+
logits = model(x) # -> (1, 200)
|
| 99 |
+
pred = logits.softmax(-1).argmax(-1).item()
|
| 100 |
+
# pred = 0, confidence 0.318 — the true class is 0, so this sample is correct.
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
On the first 12 SoyLocal test images this checkpoint is right 6 times, matching its 55.5% test
|
| 104 |
+
accuracy on the full split.
|
| 105 |
+
|
| 106 |
+
## Results (each file's own score, not the paper's aggregate)
|
| 107 |
+
|
| 108 |
+
SoyLocal (200 cultivars) top-1, the released single-seed checkpoints, by arm and resolution:
|
| 109 |
+
|
| 110 |
+
| Arm | 224 | 448 | 672 |
|
| 111 |
+
|---|---|---|---|
|
| 112 |
+
| Frozen | 28.0 | 45.3 | 27.5 |
|
| 113 |
+
| Adapter | 33.0 | 55.7 | 36.3 |
|
| 114 |
+
| ILA++ | 54.7 | 55.2 | 54.0 |
|
| 115 |
+
| AAA | 45.7 | 55.5 | 56.7 |
|
| 116 |
+
|
| 117 |
+
These are individual checkpoints on one dataset and one seed; they are noisier than the papers'
|
| 118 |
+
means over ten datasets and three seeds. The papers report the aggregate (ILA with SAW averages
|
| 119 |
+
73.5% at 448 across the ten UFGIR sets). Every per-file score is the `accuracy` column of
|
| 120 |
+
`manifest.csv`.
|
| 121 |
+
|
| 122 |
+
## Superseded and non-paper runs
|
| 123 |
+
|
| 124 |
+
Kept for completeness but not printed in any paper: `aaa_fungi` (on FungiTastic the plain adapter
|
| 125 |
+
beats AAA, so it does not carry the method) and the medical breadth runs. Learning-rate searches,
|
| 126 |
+
extra seeds, best-epoch copies and exploratory ablations were removed during consolidation and are
|
| 127 |
+
not in this repository.
|
| 128 |
+
|
| 129 |
+
## Requirements
|
| 130 |
+
|
| 131 |
+
- `torch>=2.5`, `timm==0.9.12` (the checkpoints were trained on it and the vendored model code forks
|
| 132 |
+
that version — newer timm changes the ViT internals), `huggingface_hub`, `safetensors`,
|
| 133 |
+
`einops`, `ml_collections`.
|
| 134 |
+
- The 15 `ila_saw` SAW contrastive-head checkpoints carry an older projection-head layout; their
|
| 135 |
+
manifest `loads` is `False` and `fgir_zoo` refuses them rather than loading loosely.
|
| 136 |
+
|
| 137 |
+
## Citation
|
| 138 |
+
|
| 139 |
+
The published ILA method:
|
| 140 |
+
|
| 141 |
+
```bibtex
|
| 142 |
+
@inproceedings{rios2024ila,
|
| 143 |
+
title = {Down-Sampling Inter-Layer Adapter for Parameter and Computation Efficient
|
| 144 |
+
Ultra-Fine-Grained Image Recognition},
|
| 145 |
+
author = {Rios, Edwin Arkel and Oyerinde, Femiloye and Hu, Min-Chun and Lai, Bo-Cheng},
|
| 146 |
+
booktitle = {Efficient Deep Learning for Foundation Models (EFM) Workshop at the European
|
| 147 |
+
Conference on Computer Vision (ECCV)},
|
| 148 |
+
year = {2024}
|
| 149 |
+
}
|
| 150 |
+
```
|
| 151 |
|
| 152 |
+
The SAW extension and the AAA (attention-aggregation adapter) paper are under submission; this card
|
| 153 |
+
will be updated with their citations when they are available.
|
|
|