Learning to Select Base Classes for Few-Shot Classification

Linjun Zhou, Peng Cui, Xu Jia, Shiqiang Yang, Qi Tian

Introduction

Few-shot learning (FSL) has traditionally focused on developing algorithms that can learn from a limited number of examples, assuming the training data (base classes) is fixed. This paper shifts the focus to a more fundamental question: Which data should we learn from in the first place? By optimizing the selection of base classes, the authors demonstrate that few-shot performance can be significantly improved, sometimes by as much as 13%.

The Challenge of Base Class Selection

In a typical FSL setup, a model is trained on base classes with abundant data to facilitate rapid adaptation to novel classes with few examples. Usually, these base classes are chosen randomly or based on human intuition. However, the authors identify two major hurdles in optimizing this selection:

  1. Combinatorial Complexity: Selecting $M$ classes from $N$ candidates creates a search space of $O(N^M)$, making exhaustive search impossible.
  2. The Proxy Problem: Performance on novel classes cannot be directly optimized during the selection phase because data for those classes is unavailable. A reliable "proxy" metric is required.

Proposed Methodology

The researchers propose a two-part solution: a metric called the Similarity Ratio (SR) and a framework for Submodular Optimization.

1. The Similarity Ratio (SR)

The SR metric balances two competing requirements for effective base classes:

  • Similarity: Base classes should share features with target novel classes to ensure relevant knowledge transfer.
  • Diversity: Base classes should be diverse among themselves to prevent the model from becoming overly specialized or redundant.

Mathematically, SR is defined as the ratio of the average similarity of the top-K most similar base classes to the average similarity of all selected base classes.

2. Submodular Optimization

The selection process is framed as a submodular optimization problem. Submodularity reflects the principle of "diminishing returns"—as the set of selected base classes grows, the marginal benefit of adding another class decreases. This mathematical property allows the use of efficient greedy algorithms.

Algorithm 3: Random Greedy Algorithm used for non-monotone submodular optimization settings.

The authors provide several algorithms tailored to different scenarios, including Algorithm 3 (Random Greedy) for "non-monotone" settings where adding more classes might eventually decrease the Similarity Ratio.

Key Insights: The Balance of Similarity and Diversity

A critical finding of the study is that similarity is not the only factor for success. When the number of similar classes ($K$) is small, similarity dominates. However, as more classes are added, the benefit of pure similarity saturates.

The ratio of diversity to similarity coefficients (beta2/beta1) as a function of K, illustrating the shifting importance between the two metrics.

As shown in the figure above, the relative importance of diversity increases as $K$ grows. To build a robust feature extractor, the model eventually requires dissimilar (diverse) classes to generalize effectively across the feature space.

Experimental Results

The method was evaluated on ImageNet, Caltech256, and CUB-2011 (fine-grained birds). Key results include:

  • ImageNet: Selecting the optimal 100 base classes improved 5-shot accuracy by approximately 4% over random selection.
  • Fine-Grained Tasks: The most significant gains occurred in the CUB-2011 dataset, where the method improved accuracy by 13.6% for 20-shot tasks.
  • Versatility: The selection method is model-agnostic, working effectively regardless of whether the few-shot head uses Cosine Similarity or Softmax Regression.

Conclusion and Future Work

This research highlights that what we train on is just as important as how we train. By using submodular optimization and the Similarity Ratio, practitioners can systematically select training data that maximizes transferability. Future work may involve dynamically automating the choice of the hyperparameter $K$ based on specific dataset complexities and addressing potential biases in the candidate class pool.

Summary updated

BibTeX
@inproceedings{zhou2020learning,
  author = {Linjun Zhou and Peng Cui and Xu Jia and Shiqiang Yang and Qi Tian},
  title = {{Learning to Select Base Classes for Few-Shot Classification}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2020},
  doi = {10.1109/cvpr42600.2020.00468},
}
Figure