SimpleShot: Revisiting Nearest-Neighbor Classification for Few-Shot Learning

Yan Wang, Wei-Lun Chao, Kilian Q. Weinberger, Laurens van der MaatenarXiv 2019

Introduction

Few-shot learning (FSL) presents the challenge of training models to generalize to novel categories from only a handful of labeled examples. To address this, the research community has largely pivoted towards complex meta-learning frameworks, such as Model-Agnostic Meta-Learning (MAML) or Prototypical Networks (ProtoNet), which simulate few-shot tasks during training. However, these methods often introduce significant implementation complexity and computational overhead.

SimpleShot investigates whether this complexity is necessary. By revisiting the fundamentals of feature representation and geometric alignment, the authors demonstrate that a standard feature extractor combined with simple transformations can achieve state-of-the-art performance, challenging the current dominance of meta-learning paradigms.

Methodology

The SimpleShot approach is characterized by its simplicity, consisting of two distinct phases:

  1. Standard Representation Learning: A convolutional neural network (backbone) is trained on base classes using standard cross-entropy loss. Unlike meta-learning, this phase does not involve episodic training or task-specific optimization.
  2. SimpleShot Inference with CL2N: At test time, the backbone serves as a fixed feature extractor. Before classification, two "trivial" transformations are applied to the features:
  3. Centering (Mean Subtraction): The mean feature vector of the base classes is calculated and subtracted from all features. This centers the data distribution around the origin, which is crucial for the subsequent normalization step.
  4. L2-Normalization: Features are scaled to unit length, effectively projecting them onto a hypersphere.

The combination of these steps, termed CL2N, ensures that Euclidean distance in the transformed space effectively captures class similarity. For multi-shot tasks, the model computes the centroid of the support examples for each class and assigns the query to the nearest centroid.

Impact of feature normalization on absolute accuracy improvement across various network architectures.

Experimental Results

The authors evaluated SimpleShot across several benchmarks, including miniImageNet, tieredImageNet, CIFAR-100, and Meta-iNat. The results consistently show that the CL2N transformation provides a significant performance boost regardless of the underlying architecture.

Performance on miniImageNet

On the miniImageNet benchmark, SimpleShot achieves highly competitive results. For instance, using a ResNet-18 backbone, SimpleShot (CL2N) reaches 62.85% accuracy in 1-shot, 5-way tasks. This performance exceeds that of many established meta-learning methods, including the original ProtoNet (~54%) and MAML (~49%).

Few-shot classification performance on miniImageNet comparing SimpleShot against state-of-the-art meta-learning methods.

Robustness and Universality

Beyond miniImageNet, SimpleShot set new high bars for non-transductive methods on tieredImageNet, reaching 71.32% 1-shot accuracy with a DenseNet backbone. Interestingly, the authors found that applying CL2N to the features of a pre-trained ProtoNet still improved its performance, indicating that even meta-learned features benefit from these simple geometric transforms.

As shown in the analysis of feature normalization, the absolute accuracy improvement from UN (unnormalized) to CL2N is consistent across backbones ranging from simple Conv-4 networks to deeper ResNet and DenseNet architectures. This suggests that the benefits of geometric alignment are universal and not tied to specific model capacities.

Discussion and Conclusion

The success of SimpleShot suggests that the primary driver of performance in few-shot learning may be the quality of the underlying representations rather than the meta-learning machinery itself. By focusing on the geometry of the feature space through centering and normalization, simple nearest-neighbor classifiers can outperform sophisticated algorithms.

While SimpleShot sets a strong baseline, limitations remain. Its performance is heavily dependent on the backbone's pre-training, and its efficacy in extreme cross-domain scenarios—where the feature distribution of novel classes differs radically from base classes—requires further investigation. Nonetheless, SimpleShot serves as a crucial reminder to the field: sometimes, the simplest solution is the most effective.

Summary updated

BibTeX
@misc{wang2019simpleshot,
  author = {Yan Wang and Wei-Lun Chao and Kilian Q. Weinberger and Laurens van der Maaten},
  title = {{SimpleShot: Revisiting Nearest-Neighbor Classification for Few-Shot Learning}},
  year = {2019},
  eprint = {1911.04623},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1911.04623},
}
Figure