Partner-Assisted Learning for Few-Shot Image Classification

Jiawei Ma, Hanchen Xie, Guangxing Han, Shih-Fu Chang, Aram Galstyan, Wael Abd-Almageed

TL;DR

Partner-Assisted Learning (PAL) is a novel two-stage training strategy that significantly boosts few-shot image classification performance. By using a contrastively-trained "Partner Encoder" to provide dynamic "soft-anchor" regularization for a "Main Encoder," the method learns a feature space that is exceptionally well-suited for classifying unseen categories with only a handful of examples.

What Problem Does This Paper Address?

Few-shot learning (FSL) is the challenge of teaching a machine to recognize new object categories after seeing just one or five examples—a feat humans perform effortlessly. The dominant approach involves training a deep feature extractor on a large "base" dataset and then adapting it to "novel" classes.

However, standard training methods like cross-entropy (CE) often focus too much on "hard-anchors" (fixed class weight vectors). This can lead the model to discard fine-grained visual details that aren't necessary for the base classes but might be crucial for distinguishing between new, unseen categories. The goal of this paper is to design a training strategy that produces a more "elemental" representation—one that is both compact within classes and highly discriminative between them, even for novel data.

Methods

The authors introduce Partner-Assisted Learning (PAL), a two-stage pipeline illustrated in Figure 2:

Figure 2: Training pipeline of Partner-Assisted Learning. (a) Train the Partner Encoder fP by supervised contrastive learning LSupCT to model the pair-wise similarity among all features. (b) Train the Main Encoder fM by imposing either logit-level or feature-level alignments using the pretrained fP . Both fP and fM use ResNet-12[17] and each gray block denotes a fully-connected layer.
  1. Stage 1: Train the Partner Encoder ($f_P$): This model is trained using Supervised Contrastive Learning ($L_{SupCT}$). Instead of just predicting class labels, it learns by pushing features of the same class together and pulling different classes apart. This creates a rich pool of feature instances that serve as "soft-anchors."
  2. Stage 2: Train the Main Encoder ($f_M$): The Main Encoder is trained from scratch using standard classification loss ($L_{CE}$). Crucially, its learning is regularized by the fixed Partner Encoder through two alignment constraints:
  3. Logit-Level Alignment: The model ensures that the probability distributions (logits) produced by the Main Encoder for a given class are consistent with the relationships modeled by the Partner Encoder.
  4. Feature-Level Alignment: The Main Encoder's features are directly compared against a randomly sampled subset of soft-anchors from the Partner Encoder's feature pool.

At inference time, the Partner Encoder is discarded. Only the Main Encoder is used to extract features, and classification is performed by comparing a new sample to the average features (prototypes) of the few available labeled examples.

Datasets

The authors evaluated PAL on four standard few-shot classification benchmarks:

  • miniImageNet: A subset of ImageNet with 100 classes and 84x84 images.
  • tieredImageNet: A larger, hierarchical subset of ImageNet (608 classes) where base and novel classes are semantically distinct.
  • CIFAR-FS: A few-shot version of the CIFAR-100 dataset (32x32 images).
  • FC100: Another CIFAR-100 derivative with a challenging hierarchical split.

Key Insights and Ideas

  • Soft-Anchors vs. Hard-Anchors: Traditional classification uses "hard-anchors" (weights in a linear layer) which can be too rigid. PAL’s "soft-anchors" are actual feature instances, which better preserve the nuanced, instance-level similarities helpful for generalizing to new domains.
  • The Power of Contrastive Regularization: While contrastive learning is often used as a standalone pretraining task, PAL shows it is highly effective as a regularizer for a standard classification model.
  • Better Feature Distribution: As shown in Figure 3, PAL produces much cleaner, more separated clusters for novel classes compared to standard cross-entropy training. This directly translates to better accuracy when using simple nearest-neighbor classification.
Figure 3: Visualization on five base classes using model trained by (a) supervised contrastive loss LSupCT and (b) cross-entropy loss LCE, and visualisa- tion on five novel classes using model learned by (c) LCE and (d) PAL (our method). (a) LSupCT is used to cluster all features using class label, and the features in each cluster can be used as soft-anchors, while (b) LCE trains network to learn hard-anchors for classification. The feature distribution on novel classes by (d) PAL benefits the prototype classification compared with (c) the distribution of LCE. More visualization can be found in supp. material.

Key Results

PAL consistently outperformed state-of-the-art (SOTA) methods across all four benchmarks in both 1-shot and 5-shot scenarios.

  • miniImageNet: Achieved 69.37% (1-shot) and 84.40% (5-shot) accuracy, surpassing strong baselines like RFS-distill.
  • tieredImageNet: Reached 72.25% (1-shot) and 86.95% (5-shot).
  • Base Class Performance: Interestingly, PAL also improved accuracy on the original base classes (e.g., 82.98% on miniImageNet base vs. 80.90% for standard CE), proving that the learned representations are generally superior, not just better for few-shot tasks.

Detailed results for ImageNet-based datasets are shown in Table 1: Table 1: PAL Results

Table 1: PAL Result on miniImageNet and tieredImageNet datasets. †: Results are generated on Train+Val set

Limitations and Future Work

The paper notes a few areas for further exploration:

  • Training Complexity: The two-stage process requires training two separate models sequentially, which is more computationally intensive than single-stage training.
  • Hyperparameter Tuning: The temperature scaling factor ($\tau$) required different settings for ImageNet-derived datasets (0.5) versus CIFAR-derived ones (0.1), suggesting some sensitivity to data scale or resolution.
  • Future Directions: The authors suggest that exploring different architectures for the Partner Encoder or investigating end-to-end joint training of both encoders could be fruitful.

Summary updated

BibTeX
@inproceedings{ma2021partner,
  author = {Jiawei Ma and Hanchen Xie and Guangxing Han and Shih-Fu Chang and Aram Galstyan and Wael Abd-Almageed},
  title = {{Partner-Assisted Learning for Few-Shot Image Classification}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2021},
  doi = {10.1109/iccv48922.2021.01040},
}
Figure