Paper · 2020-03-25 · cs.CV, cs.LG
Rethinking Few-Shot Image Classification: a Good Embedding Is All You Need?
RFS: train one ResNet-12 with plain cross-entropy on all meta-training classes merged, freeze it, and fit an L2-normalized logistic regression on each test episode's support features. Born-again self-distillation adds 2-3 points. Reported 64.82/82.14% on miniImageNet 5-way 1/5-shot, beating MetaOptNet (62.64/78.63) with no meta-learning.
Few-shot learningMeta-learningKnowledge distillationLinear probingfew-shotmeta-learningdistillationlinear-probeimage-classification
arXivPDFCodeMarkdown13 min read
AI-compiled by claude-opus-5-5 on 2026-10-18, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.
In plain words
Few-shot classification asks a model to recognise new categories from a handful of labelled pictures, sometimes just one per category. A large body of work, "meta-learning", tries to solve this by training on thousands of small practice tasks so the model learns how to learn quickly.
This paper asks whether all that machinery is needed. The authors take every training category, pool them into one ordinary classification problem, and train a standard network on it. They then throw away the final classification layer and use the rest as a fixed feature extractor. For each new few-shot task they fit a simple linear classifier (logistic regression) on the features of the few labelled examples. Nothing in the network is adapted at test time.
This plain baseline matches or beats the elaborate meta-learning methods it is compared against on four standard benchmarks. A second trick, training a fresh copy of the network to imitate the first one's soft predictions ("self-distillation"), adds a couple more points. The takeaway for practitioners: on these benchmarks, the quality of the learned features matters more than the cleverness of the adaptation algorithm.
TL;DR
Pre-train an embedding network with cross-entropy on the union of all meta-training classes, freeze it, L2-normalise its features and train a per-episode multinomial logistic regression on the support set. Optionally apply one or two rounds of born-again self-distillation before freezing. With a ResNet-12 this reaches 62.02/79.64% (simple) and 64.82/82.14% (distilled) on miniImageNet 5-way 1/5-shot, and beats the best reported Meta-Dataset baselines on 9 of 10 test domains, all author-reported. Relevant if you need a strong, cheap few-shot baseline or want to test whether a meta-learning method actually beats a linear probe.
Problem
Meta-learning methods for few-shot classification train an embedding (and often an adaptation procedure) over episodes sampled from a task distribution §3.1 eq. 1 eq. 2. It was unclear whether their gains come from the meta-learning algorithm or simply from the learned representation §1. Prior baselines either fine-tuned the network on the test support set, sometimes transductively using test queries, or performed slightly worse than meta-learning §1. The paper's setting is inductive: no query information is used and the embedding stays frozen at meta-test time §1 §3.2.
Method
The meta-training set is a collection of tasks \mathcal{T} = \{(\mathcal{D}^{train}_i, \mathcal{D}^{test}_i)\}_{i=1}^I §3.1. A base learner \mathcal{A} fits parameters \theta on a task's training split given a fixed embedding f_\phi:
\theta = \mathcal{A}(\mathcal{D}^{train}; \phi) = \arg\min_\theta \mathcal{L}^{base}(\mathcal{D}^{train}; \theta, \phi) + \mathcal{R}(\theta) eq. 1
Meta-learning chooses \phi to minimise the expected query loss \phi = \arg\min_\phi \mathbb{E}_{\mathcal{T}}[\mathcal{L}^{meta}(\mathcal{D}^{test}; \theta, \phi)] eq. 2, and evaluation averages the same loss over held-out tasks \mathcal{S} eq. 3.
Step 1: embedding by plain classification. Merge all meta-training tasks into one dataset and train with cross-entropy over all classes §3.2:
\mathcal{D}^{new} = \{(\mathbf{x}_i, y_i)\}_{k=1}^K = \cup\{\mathcal{D}^{train}_1, \ldots, \mathcal{D}^{train}_i, \ldots, \mathcal{D}^{train}_I\} eq. 4
\phi = \arg\min_\phi \mathcal{L}^{ce}(\mathcal{D}^{new}; \phi) eq. 5
The network up to the penultimate layer is kept as the feature extractor §1 fig. 1; the classification layer is dropped at meta-test time fig. 5. The authors stress the classes across tasks are mutually exclusive, so the merge produces one large many-way problem; a multi-task alternative with one head per task scored 58.53 ± 0.8 vs 62.02 ± 0.63 on miniImageNet 5-way 1-shot §4.9 §6.
Step 2: per-episode linear base learner. For each meta-test task, fit multinomial logistic regression on the frozen support features §3.2 fig. 2:
\theta = \arg\min_{\{W, b\}} \sum_{t=1}^T \mathcal{L}^{ce}_t(W f_\phi(\mathbf{x}_t) + b, y_t) + \mathcal{R}(W, b) eq. 6
Features are L2-normalised onto the unit sphere and each support image is augmented into 5 samples before fitting §4.5 tab. 4. The classifier is re-initialised per task; the embedding is never fine-tuned §3.2. The implementation uses scikit-learn §4.1.
Step 3 (optional): sequential self-distillation. Train a new network of identical architecture on the same merged data with a weighted sum of cross-entropy and KL divergence to the previous network's predictions §3.3:
\phi' = \arg\min_{\phi'} \left(\alpha\, \mathcal{L}^{ce}(\mathcal{D}^{new}; \phi') + \beta\, KL(f(\mathcal{D}^{new}; \phi'), f(\mathcal{D}^{new}; \phi))\right) eq. 7
with "usually \beta = 1-\alpha" §3.3. Repeat born-again style, generation k distilled from generation k-1 fig. 3:
\phi_k = \arg\min_\phi \left(\alpha\, \mathcal{L}^{ce}(\mathcal{D}^{new}; \phi) + \beta\, KL(f(\mathcal{D}^{new}; \phi), f(\mathcal{D}^{new}; \phi_{k-1}))\right) eq. 8
After K rounds, \phi_K is the meta-test embedding §3.3. The reported tables use generation 2 on miniImageNet, CIFAR-FS and FC100 and generation 1 on tieredImageNet, chosen on the validation set §4.6.
Algorithm: RFS (simple + distill) [§3.2] [§3.3] [§4.1]
Input: merged meta-training set D_new (all base classes), generations K
1. phi_0 <- train network (backbone + linear head over all base classes)
on D_new with cross-entropy [eq. 5]
2. for k = 1..K:
init a fresh network with the same architecture
[code: train_distillation.py#L263-L264]
train it on D_new with alpha*CE(labels) + beta*KL(student, teacher phi_{k-1}),
teacher frozen in eval mode [eq. 8] [code: train_distillation.py#L366-L435]
phi_k <- student
3. Drop the classification head; embedding = global-avg-pooled penultimate features [§4.1] [fig. 5]
Meta-test, per episode (N-way, n-shot):
4. Augment each support image into 5 randomly transformed copies [§4.5]
5. z = f_phiK(x); z <- z / ||z||_2 for support and query [§4.5]
6. Fit N-way multinomial logistic regression on support (z, y) [eq. 6]
7. Predict query labels; accuracy averaged over sampled episodesOther base learners compared: nearest neighbour with Euclidean distance (NN) and NN on normalised features, which is a cosine classifier §4.5 §4.6; linear SVM on Meta-Dataset §5.
Self-supervised variant. A ResNet-50 trained without labels on the miniImageNet meta-train set with MoCo or CMC, then linear-probed the same way §4.4 app. C.
Hyperparameters
| Name | Value | Where | Notes |
|---|---|---|---|
| backbone | ResNet-12: 4 residual blocks × 3 conv 3×3, filters (64,160,320,640), global avg-pool | §4.1 fig. 5 | identical to MetaOptNet's ResNet-12 per paper |
| max-pool | 2×2 after each of first 3 blocks | §4.1 | code pools after all 4 blocks, see Paper vs code |
| regulariser | DropBlock | §4.1 | rate 0.1, block size 5 (ImageNet) / 2 (CIFAR) only in code util.py util.py |
| activation | not stated | LeakyReLU(0.1) in code resnet.py | |
| optimizer | SGD, momentum 0.9 | §4.1 | |
| weight decay | 5e-4 | §4.1 | |
| batch size | 64 | §4.1 | |
| initial LR | 0.05 | §4.1 | |
| LR decay | ×0.1, three times; twice on miniImageNet | §4.1 | decay epochs not stated; code default 60,80 for miniImageNet train_supervised.py |
| epochs | 100 miniImageNet, 60 tieredImageNet, 90 CIFAR-FS and FC100 | §4.1 | |
| ConvNet-4 on miniImageNet | 240 epochs, decay ×0.1 at 150, 180, 210 | app. B | other datasets use ResNet-12 setup |
| SEResNet-12 | same setup as ResNet-12; SE reduction 4 | app. B fig. 5 | |
| train augmentation | random crop, colour jitter, horizontal flip | §4.1 | code: crop 84 pad 8 (32 pad 4 for CIFAR), jitter 0.4 brightness/contrast/saturation transform_cfg.py transform_cfg.py |
| input size | 84×84 (ImageNet derivatives) | tab. 1 | CIFAR 32×32 in code transform_cfg.py |
| distillation α, β | 0.5, 0.5 | §4.1 | same LR schedule as pre-training |
| KD temperature | not stated | 4 in code, loss scaled by T² train_distillation.py criterion.py | |
| distillation generations used | 2 (mini, CIFAR-FS, FC100), 1 (tiered) | §4.6 | selected on validation set |
| support augmentation at test | 5 augmented samples per support image | §4.5 tab. 4 | |
| feature normalisation | L2 | §4.5 | |
| base learner | N-way logistic regression (scikit-learn) | §4.1 | code: L2 penalty, C=1.0, lbfgs, max_iter 1000, multinomial meta_eval.py |
| queries per class | not stated | 15 in code eval_fewshot.py | |
| evaluation episodes | 3 runs × 1000 episodes (ImageNet derivs), 3 runs × 3000 (CIFAR derivs); median of 3 runs reported | §4.2 §4.3 | code default 600 eval_fewshot.py |
| Meta-Dataset backbone | ResNet-18, input 128×128 | §5 | not in released code |
| Meta-Dataset optimiser | SGD momentum 0.9, LR 0.1 ÷10 every 30 epochs, 90 epochs, batch 256 | §5 | weight decay not stated |
| Meta-Dataset augmentation | random resized crop, horizontal flip; no test-time augmentation | §5 | |
| Meta-Dataset distillation | α=0.5, β=1.0, 2 generations | §5 | note β ≠ 1−α here |
| self-supervised ResNet-50 | first layer adapted to 84×84; 2048 negatives; 2000 epochs; LR 0.03 cosine | app. C | otherwise CMC/MoCo recipe; trained on meta-train only |
Results
Author-reported, ResNet-12 unless noted, 5-way, accuracy (%) with 95% confidence intervals tab. 1 tab. 2.
Selected rows of Table 1 (miniImageNet and tieredImageNet, 84×84 input):
| Model | Backbone | mini 1-shot | mini 5-shot | tiered 1-shot | tiered 5-shot |
|---|---|---|---|---|---|
| MAML | 32-32-32-32 | 48.70 ± 1.84 | 63.11 ± 0.92 | 51.67 ± 1.81 | 70.30 ± 1.75 |
| Prototypical Networks† | 64-64-64-64 | 49.42 ± 0.78 | 68.20 ± 0.66 | 53.31 ± 0.89 | 72.69 ± 0.74 |
| TADAM | ResNet-12 | 58.50 ± 0.30 | 76.70 ± 0.30 | - | - |
| Shot-Free | ResNet-12 | 59.04 | 77.64 | 63.52 | 82.59 |
| MTL | ResNet-12 | 61.20 ± 1.80 | 75.50 ± 0.80 | - | - |
| MetaOptNet | ResNet-12 | 62.64 ± 0.61 | 78.63 ± 0.46 | 65.99 ± 0.72 | 81.56 ± 0.53 |
| Fine-tuning (Dhillon et al.) | WRN-28-10 | 57.73 ± 0.62 | 78.17 ± 0.49 | 66.58 ± 0.70 | 85.55 ± 0.48 |
| LEO-trainval† | WRN-28-10 | 61.76 ± 0.08 | 77.59 ± 0.12 | 66.33 ± 0.05 | 81.44 ± 0.09 |
| Ours-simple | ResNet-12 | 62.02 ± 0.63 | 79.64 ± 0.44 | 69.74 ± 0.72 | 84.41 ± 0.55 |
| Ours-distill | ResNet-12 | 64.82 ± 0.60 | 82.14 ± 0.43 | 71.52 ± 0.69 | 86.03 ± 0.49 |
† trained on train+val. Source: tab. 1. With the WRN-28-10 backbone of Dhillon et al., the simple frozen-embedding baseline gets 61.1 ± 0.86 on miniImageNet 1-shot vs their fine-tuned 57.73 ± 0.62 §4.2.
Table 2 (CIFAR-FS and FC100):
| Model | Backbone | CIFAR-FS 1-shot | CIFAR-FS 5-shot | FC100 1-shot | FC100 5-shot |
|---|---|---|---|---|---|
| MAML | 32-32-32-32 | 58.9 ± 1.9 | 71.5 ± 1.0 | - | - |
| Prototypical Networks | 64-64-64-64 | 55.5 ± 0.7 | 72.0 ± 0.6 | 35.3 ± 0.6 | 48.6 ± 0.6 |
| Relation Networks | 64-96-128-256 | 55.0 ± 1.0 | 69.3 ± 0.8 | - | - |
| R2D2 | 96-192-384-512 | 65.3 ± 0.2 | 79.4 ± 0.1 | - | - |
| TADAM | ResNet-12 | - | - | 40.1 ± 0.4 | 56.1 ± 0.4 |
| Shot-Free | ResNet-12 | 69.2 | 84.7 | - | - |
| TEWAM | ResNet-12 | 70.4 | 81.3 | - | - |
| Prototypical Networks | ResNet-12 | 72.2 ± 0.7 | 83.5 ± 0.5 | 37.5 ± 0.6 | 52.5 ± 0.6 |
| MetaOptNet | ResNet-12 | 72.6 ± 0.7 | 84.3 ± 0.5 | 41.1 ± 0.6 | 55.5 ± 0.6 |
| Ours-simple | ResNet-12 | 71.5 ± 0.8 | 86.0 ± 0.5 | 42.6 ± 0.7 | 59.1 ± 0.6 |
| Ours-distill | ResNet-12 | 73.9 ± 0.8 | 86.9 ± 0.5 | 44.6 ± 0.7 | 60.9 ± 0.6 |
Ablation, ResNet-12 tab. 4:
| NN | LR | L2 | Aug | Distill | mini 1 | mini 5 | tiered 1 | tiered 5 | CIFAR-FS 1 | CIFAR-FS 5 | FC100 1 | FC100 5 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ✓ | 56.29 | 69.96 | 64.80 | 78.75 | 64.36 | 78.00 | 38.40 | 49.12 | ||||
| ✓ | 58.74 | 78.31 | 67.62 | 84.77 | 66.92 | 84.78 | 40.36 | 57.23 | ||||
| ✓ | ✓ | 61.56 | 79.27 | 69.53 | 85.08 | 71.24 | 85.63 | 42.77 | 58.86 | |||
| ✓ | ✓ | ✓ | 62.02 | 79.64 | 69.74 | 85.23 | 71.45 | 85.95 | 42.59 | 59.13 | ||
| ✓ | ✓ | ✓ | ✓ | 64.82 | 82.14 | 71.52 | 86.03 | 73.89 | 86.93 | 44.57 | 60.91 |
Self-supervised vs supervised ResNet-50 embeddings, miniImageNet 5-way tab. 3:
| Model | Backbone | 1-shot | 5-shot |
|---|---|---|---|
| Supervised | ResNet50 | 57.56 ± 0.79 | 73.81 ± 0.63 |
| MoCo | ResNet50 | 54.19 ± 0.93 | 73.04 ± 0.61 |
| CMC | ResNet50 (each view encoder 0.5× width) | 56.10 ± 0.89 | 73.87 ± 0.65 |
Backbones and train+val data, miniImageNet / tieredImageNet tab. 5:
| Variant | Backbone | mini 1-shot | mini 5-shot | tiered 1-shot | tiered 5-shot |
|---|---|---|---|---|---|
| Ours | 64-64-64-64 | 55.25 ± 0.58 | 71.56 ± 0.52 | 56.18 ± 0.70 | 72.99 ± 0.55 |
| Ours-distill | 64-64-64-64 | 55.88 ± 0.59 | 71.65 ± 0.51 | 56.76 ± 0.68 | 73.21 ± 0.54 |
| Ours-trainval | 64-64-64-64 | 56.32 ± 0.58 | 72.46 ± 0.52 | 56.53 ± 0.68 | 73.15 ± 0.58 |
| Ours-distill-trainval | 64-64-64-64 | 56.64 ± 0.58 | 72.85 ± 0.50 | 57.35 ± 0.70 | 73.98 ± 0.56 |
| Ours | ResNet-12 | 62.02 ± 0.63 | 79.64 ± 0.44 | 69.74 ± 0.72 | 84.41 ± 0.55 |
| Ours-distill | ResNet-12 | 64.82 ± 0.60 | 82.14 ± 0.43 | 71.52 ± 0.69 | 86.03 ± 0.49 |
| Ours-trainval | ResNet-12 | 63.59 ± 0.61 | 80.86 ± 0.47 | 71.12 ± 0.68 | 85.94 ± 0.46 |
| Ours-distill-trainval | ResNet-12 | 66.58 ± 0.65 | 83.22 ± 0.39 | 72.98 ± 0.71 | 87.46 ± 0.44 |
| Ours | SEResNet-12 | 62.29 ± 0.60 | 79.94 ± 0.46 | 70.31 ± 0.70 | 85.22 ± 0.50 |
| Ours-distill | SEResNet-12 | 65.96 ± 0.63 | 82.05 ± 0.46 | 71.72 ± 0.69 | 86.54 ± 0.49 |
| Ours-trainval | SEResNet-12 | 64.07 ± 0.61 | 80.92 ± 0.43 | 71.76 ± 0.66 | 86.27 ± 0.45 |
| Ours-distill-trainval | SEResNet-12 | 67.73 ± 0.63 | 83.35 ± 0.41 | 72.55 ± 0.69 | 86.72 ± 0.49 |
Backbones and train+val data, CIFAR-FS / FC100 tab. 6:
| Variant | Backbone | CIFAR-FS 1-shot | CIFAR-FS 5-shot | FC100 1-shot | FC100 5-shot |
|---|---|---|---|---|---|
| Ours | 64-64-64-64 | 62.7 ± 0.8 | 78.7 ± 0.5 | 39.6 ± 0.6 | 53.5 ± 0.5 |
| Ours-distill | 64-64-64-64 | 63.8 ± 0.8 | 79.5 ± 0.5 | 40.3 ± 0.6 | 54.1 ± 0.5 |
| Ours-trainval | 64-64-64-64 | 63.5 ± 0.8 | 79.8 ± 0.5 | 43.2 ± 0.6 | 58.5 ± 0.5 |
| Ours-distill-trainval | 64-64-64-64 | 64.9 ± 0.8 | 80.3 ± 0.5 | 44.6 ± 0.6 | 59.2 ± 0.5 |
| Ours | ResNet-12 | 71.5 ± 0.8 | 86.0 ± 0.5 | 42.6 ± 0.7 | 59.1 ± 0.6 |
| Ours-distill | ResNet-12 | 73.9 ± 0.8 | 86.9 ± 0.5 | 44.6 ± 0.7 | 60.9 ± 0.6 |
| Ours-trainval | ResNet-12 | 73.1 ± 0.8 | 86.7 ± 0.5 | 49.5 ± 0.7 | 66.4 ± 0.6 |
| Ours-distill-trainval | ResNet-12 | 75.4 ± 0.8 | 88.2 ± 0.5 | 51.6 ± 0.7 | 68.4 ± 0.6 |
| Ours | SEResNet-12 | 72.0 ± 0.8 | 86.0 ± 0.6 | 43.4 ± 0.6 | 59.1 ± 0.6 |
| Ours-distill | SEResNet-12 | 74.2 ± 0.8 | 87.2 ± 0.5 | 44.9 ± 0.6 | 61.4 ± 0.6 |
| Ours-trainval | SEResNet-12 | 73.3 ± 0.8 | 86.8 ± 0.5 | 49.9 ± 0.7 | 66.8 ± 0.6 |
| Ours-distill-trainval | SEResNet-12 | 75.6 ± 0.8 | 88.2 ± 0.5 | 52.0 ± 0.7 | 68.8 ± 0.6 |
Meta-Dataset, embedding trained on the ILSVRC train split only, ResNet-18, variable ways and shots, 1000 tasks per evaluation §5 tab. 7. "Best" is the per-dataset maximum over 7 methods and 3 architectures from the Meta-Dataset paper:
| Dataset | Best prior | LR | SVM | LR-distill | SVM-distill |
|---|---|---|---|---|---|
| ILSVRC | 50.50 | 60.14 | 56.48 | 61.48 | 58.33 |
| Omniglot | 63.37 | 64.92 | 65.90 | 64.31 | 66.77 |
| Aircraft | 68.69 | 63.12 | 61.43 | 62.32 | 64.23 |
| Birds | 68.66 | 77.69 | 74.61 | 79.47 | 76.63 |
| Textures | 69.05 | 78.59 | 74.25 | 79.28 | 76.66 |
| Quick Draw | 51.52 | 62.48 | 59.34 | 60.83 | 59.02 |
| Fungi | 39.96 | 47.12 | 41.76 | 48.53 | 44.51 |
| VGG Flower | 87.15 | 91.60 | 90.32 | 91.00 | 89.66 |
| Traffic Signs | 66.79 | 77.51 | 78.94 | 76.33 | 78.64 |
| MSCOCO | 43.74 | 57.00 | 50.81 | 59.28 | 54.10 |
| Mean | 60.94 | 68.02 | 65.38 | 68.28 | 66.86 |
Across distillation generations, accuracy rises for the first two or three generations and then falls for LR and NN; normalised features largely prevent the drop §4.6 fig. 4. With normalised features LR and NN are similar at 1-shot, but LR stays clearly better at 5-shot §4.7 fig. 4.
Paper vs code
Checked against WangYueFt/rfs at f8c837b. The repository contains no
LICENSE file, so no code is quoted here.
- Max-pooling. Paper: 2×2 max-pool after each of the first 3 blocks
§4.1. Code: every block, including the fourth, ends in
MaxPool2d(2)(84 → 42 → 21 → 10 → 5 before avg-pool) resnet.py resnet.py resnet.py. - DropBlock details are only in code: drop rate 0.1, DropBlock only in
blocks 3 and 4, block size 5 for ImageNet derivatives and 2 for CIFAR, with
the drop rate ramped linearly over the first 40,000 forward passes of each block
resnet.py util.py util.py.
Blocks 1 and 2 get ordinary dropout with p=0.1 instead, since their
drop_blockflag is off resnet.py resnet.py. - KD temperature. Not stated in the paper; code uses T=4 and multiplies the KL by T² train_distillation.py criterion.py.
- Loss-weight naming. Paper weights CE by α and KL by β, α=β=0.5 §4.1
eq. 7. Code calls the CE weight
gamma(-r) and the KL weightalpha(-a); defaults are 1 and 0, i.e. no distillation unless both flags are passed train_distillation.py train_distillation.py. The example script uses-r 0.5 -a 0.5and notes-a 1.0gives similar results run.sh. - Which features feed the classifier. Paper: penultimate-layer features
§1 §3.2, except ConvNet-4 on miniImageNet where logits were used
app. B. Code:
meta_testdefaults to using the logits of the classification layer;eval_fewshot.pyprints both logit-based and feature-based accuracy on val and test without saying which is reported meta_eval.py meta_eval.py eval_fewshot.py. - Episode count. Paper: 1000 (ImageNet) or 3000 (CIFAR) episodes per run, median of 3 runs §4.2 §4.3. Code default: 600 episodes, one run, mean with t-distribution 95% interval eval_fewshot.py meta_eval.py.
- LR schedule. Only the miniImageNet default (decay at epochs 60 and 80 of 100) is in code; decay epochs for the other datasets are given in neither paper nor code train_supervised.py train_supervised.py.
- Base-learner settings come only from code: L2 penalty, C=1.0, lbfgs, 1000 iterations, multinomial; the SVM is a StandardScaler plus linear SVC with C=1 meta_eval.py.
- Test-time augmentation uses the training transform (random crop with padding, colour jitter, flip) on 5 tiled copies of each support image; no un-augmented copy is kept, and queries are not augmented mini_imagenet.py.
- Not released: Meta-Dataset (ResNet-18, 128×128) and the MoCo/CMC self-supervised training; the README points to the separate CMC repository for the latter README.md.
Pitfalls
- Logits vs features. Using classifier logits instead of pooled features is the code default and changes the embedding dimension from 640 to the number of base classes. Decide explicitly; the paper's method says penultimate features §3.2, but the evaluation script reports both eval_fewshot.py.
- L2 normalisation matters. It adds about 2-4 points of 1-shot accuracy (e.g. 58.74 → 61.56 on miniImageNet) tab. 4 and prevents the late-generation accuracy drop in distillation fig. 4. Normalise both support and query.
- Distillation needs a fresh student. The student is re-initialised, not warm-started from the teacher, and each generation is a full training run with the same schedule §4.1 train_distillation.py. Two generations triple pre-training cost.
- Generation count was tuned on validation per dataset (2, or 1 for tieredImageNet) §4.6; more generations eventually hurt for un-normalised LR and NN fig. 4.
- β is not always 1−α. Benchmarks use α=β=0.5 §4.1; Meta-Dataset uses α=0.5, β=1.0 §5.
- Architecture details are code-only (LeakyReLU 0.1, max-pool after all 4 blocks, DropBlock schedule, 1×1 stride-1 shortcut convs) resnet.py resnet.py. Results will not reproduce from the paper's text description alone.
- Code's
resnet18is not the standard ResNet-18. It stacks the same 3-conv blocks as[1,1,2,2]resnet.py. For variants with more than one block per stage,_make_layerpassesuse_seinto thedrop_blockargument slot resnet.py; ResNet-12 is unaffected. - Relies on disjoint, mergeable classes. The authors attribute the baseline's strength to merging mutually exclusive tasks into one many-way problem §4.9 §6; benchmarks without that structure may behave differently.
- Test-time augmentation is a small effect (≤0.5 points, sometimes negative: FC100 1-shot 42.77 → 42.59) tab. 4 but multiplies support-set feature extraction by 5.
- Data: the code expects MetaOptNet's pickled splits, renamed by the authors README.md; class counts are hard-coded per dataset (e.g. 64/80 miniImageNet, 351/448 tieredImageNet) train_supervised.py.
- Weight decay hits all parameters, including BatchNorm, because the optimiser receives all model parameters train_supervised.py.
Lineage
- Builds on: born-again networks (Furlanello et al.) for sequential self-distillation §3.3; knowledge distillation (Hinton et al.) §3.3; the ResNet-12 of MetaOptNet (Lee et al.) §4.1; the cross-entropy pre-training stage of TADAM and LEO §3.2.
- Compared against: MAML, Matching Networks, Prototypical Networks, Relation Networks, R2D2, TADAM, MetaOptNet, LEO, transductive fine-tuning (Dhillon et al.), Meta-Dataset baselines tab. 1 tab. 2 tab. 7.
- Self-supervised embeddings: MoCo and CMC §4.4.
Source and license
Adapted from “Rethinking Few-Shot Image Classification: a Good Embedding Is All You Need?” by Yonglong Tian, Yue Wang, Dilip Krishnan, Joshua B. Tenenbaum, Phillip Isola (arXiv:2003.11539), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors. Code citations refer to https://github.com/WangYueFt/rfs at commit f8c837ba93c6 (none (no LICENSE file in repository)). Any quoted code is shown under that license.