Improved Few-Shot Visual Classification

Peyman Bateni, Raghav Goyal, Vaden Masrani, Frank Wood, Leonid Sigal

Abstract: Few-shot learning is a fundamental task in computer vision that carries the promise of alleviating the need for exhaustively labeled data. Most few-shot learning approaches to date have focused on progressively more complex neural feature extractors and classifier adaptation strategies. In this paper, we explore the hypothesis that a simple class-covariance-based distance metric, namely the Mahalanobis distance, adopted into a state of the art few-shot learning approach (CNAPS) can, in and of itself, lead to a significant performance improvement. We also discover that it is possible to learn adaptive feature extractors that allow useful estimation of the high dimensional feature covariances required by this metric from surprisingly few samples. The result of our work is a new "Simple CNAPS" architecture which has up to 9.2% fewer trainable parameters than CNAPS and performs up to 6.1% better than state of the art on the standard few-shot image classification benchmark dataset.

Introduction

Few-shot learning (FSL) challenges models to recognize new objects after seeing only a handful of examples (the "support set"). Most modern research focuses on building increasingly complex neural networks to adapt feature extractors to specific tasks. However, a common oversight in these approaches is the final classification step, which typically assumes that every class has a uniform, spherical distribution in the feature space (the "unit-normal assumption").

In reality, different image categories exhibit varying levels of internal variation and feature correlations. For instance, a "dog" class might be more diverse in feature space than a "hot dog" class. Standard Euclidean distance ignores this "shape" of the data, leading to suboptimal decision boundaries. Simple CNAPS addresses this by positioning itself within the landscape of few-shot methods as a hybrid that uses partially adapted features with a more sophisticated distance metric.

Taxonomy of few-shot learning methods. Simple CNAPS combines partially adapted features with a Mahalanobis distance classifier, situating it among Bregman Divergence-based methods.

Methods

The researchers built upon the CNAPS (Conditional Neural Adaptive Processes) architecture, which uses a ResNet-18 feature extractor modified with FiLM layers to shift and scale internal features based on the task.

The Mahalanobis Distance

The core innovation of "Simple CNAPS" is replacing the original's complex, learned "Classification Adaptor" (a neural network with ~788,000 parameters) with the Mahalanobis distance. Unlike Euclidean distance, which measures straight-line distance to a class mean, the Mahalanobis distance accounts for the covariance (the spread and correlation) of the features.

Comparison of decision boundaries: Euclidean distance (left) creates linear boundaries that misclassify the query image, while Mahalanobis distance (right) accounts for class-specific variance to correctly classify it.

Regularized Covariance Estimation

Estimating a high-dimensional covariance matrix from only 1–5 images is mathematically noisy. To solve this, the authors use a regularized estimator: a weighted average of the specific class's covariance and the overall task's covariance. As the number of samples (the "shot") increases, the model relies more heavily on the class-specific data.

Experimental Evaluation

The model was evaluated on the Meta-Dataset, a challenging benchmark combining several distinct datasets including ImageNet, Omniglot, and out-of-domain sets like Traffic Signs and MSCOCO.

Key Results

  • State-of-the-Art Performance: Simple CNAPS achieved an average accuracy of 72.2% across all Meta-Dataset tasks, a 6.1% improvement over the original CNAPS.
  • Out-of-Domain Generalization: On datasets the model was not trained on, it outperformed the baseline by 8.2%, suggesting that accounting for feature distribution makes the model more robust to novel data types.
  • Efficiency: By removing the classification adaptor, the model has up to 9.2% fewer trainable parameters than its predecessor.

Discussion and Conclusion

The success of Simple CNAPS demonstrates that a deterministic, classic statistical tool can outperform high-capacity neural network adaptors in few-shot scenarios. It proves that with proper regularization and task-adapted feature extractors, useful covariance estimates can be derived from as few as two images.

Future work may involve moving beyond the current heuristic weighting for covariance estimation toward learned weighting parameters, or exploring other members of the "Bregman Divergence" family to further refine classification accuracy in low-data regimes.

Summary updated

BibTeX
@inproceedings{bateni2020improved,
  author = {Peyman Bateni and Raghav Goyal and Vaden Masrani and Frank Wood and Leonid Sigal},
  title = {{Improved Few-Shot Visual Classification}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2020},
  url = {https://openreview.net/forum?id=5aggcMPQxG},
}
Figure