Boosting Few-Shot Classification with View-Learnable Contrastive Learning

Xu Luo, Yuxuan Chen, Liangjian Wen, Lili Pan, Zenglin Xu

Abstract

Few-shot learning (FSL) aims to recognize novel categories from a limited number of labeled examples. While metric-based meta-learning has shown promise by learning discriminative embedding spaces, these models often struggle with fine-grained classification. This paper introduces View-Learnable Contrastive Learning (VLCL), a framework that replaces random augmentations with an adaptive "Auto-view" module to enhance few-shot performance. By integrating supervised meta-learning with self-supervised contrastive learning, VLCL learns to discover fine-grained structures within data, significantly improving accuracy on standard and fine-grained benchmarks.

Introduction

Few-shot learning is a challenging task where models must generalize to new classes using only a handful of examples. Most state-of-the-art methods rely on learning an embedding space where similar images are clustered together. However, these models often fail at fine-grained discrimination. For instance, a model trained on general labels may fail to distinguish between subtle sub-categories, such as different breeds of dogs, because the training signal lacks the necessary granularity.

Contrastive Learning (CL) can help discover latent structures without explicit labels, but it traditionally relies on random data augmentations like cropping or flipping. In data-scarce FSL scenarios, these random transformations can be noisy or destructive to the fine-grained features essential for classification. VLCL addresses this by learning to generate optimal image views that preserve and highlight discriminative features.

Methodology: The VLCL Framework

The proposed VLCL framework utilizes a dual-path architecture that integrates supervised meta-learning with self-supervised contrastive learning.

The VLCL architecture featuring the dual-path framework with the Auto-view module and bilevel optimization.

Dual-Path Learning

  1. Meta-Learning Path: Employs a Prototypical Network (PN) to map images into an embedding space where classification is performed by identifying the nearest class prototype (mean vector).
  2. Contrastive Path: Uses a Momentum Contrast (MoCo) approach to ensure that different views of the same image are clustered together while views of different images are separated.

The Auto-View Module

The core innovation is the Auto-view module, which uses a Spatial Transformer Network (STN) to generate optimal image views. Unlike static random cropping, the STN parameters are learned through a bilevel optimization strategy. In the first stage, the image encoder is updated to minimize both classification and contrastive losses. In the second stage, the STN parameters are optimized based on how well the updated encoder performs on the classification task. This ensures that the generated views (e.g., specific zooms or crops) are specifically tailored to improve discriminative accuracy.

Experimental Results

The VLCL method was evaluated on several benchmarks, including miniImageNet and fine-grained datasets like CUB-200-2011, Stanford Dogs, and Stanford Cars.

Qualitative t-SNE visualizations and quantitative accuracy comparison between the baseline and VLCL.

Quantitative Performance

VLCL consistently outperformed the baseline Prototypical Network and other competitive FSL methods. On miniImageNet, it achieved 61.75% (1-shot) and 76.32% (5-shot) accuracy, a significant jump over the baseline PN. The gains were even more pronounced in fine-grained tasks; for example, on the Cars dataset, VLCL showed a 14.83% improvement in 1-shot accuracy over the baseline.

Qualitative Analysis

As shown in the t-SNE visualizations in Figure 4, VLCL produces significantly tighter and more separable clusters for fine-grained sub-categories compared to standard methods. This suggests that the contrastive path, guided by the Auto-view module, effectively regularizes the model to capture subtle semantic differences that coarse labels might overlook.

Conclusion

VLCL demonstrates that learning to generate optimal views is superior to relying on random augmentations for few-shot classification. By combining meta-learning with view-learnable contrastive learning, the framework successfully discovers fine-grained structures in data. While the bilevel optimization introduces some computational overhead, the significant accuracy improvements—especially in fine-grained domains—make it a powerful tool for data-efficient representation learning.

Summary updated

Abstract

The goal of few-shot classification is to classify new categories with few labeled examples within each class. Nowadays, the excellent performance in handling few-shot classification problems is shown by metric-based meta-learning methods. However, it is very hard for previous methods to discriminate the fine-grained sub-categories in the embedding space without fine-grained labels. This may lead to unsatisfactory generalization to fine-grained sub-categories, and thus affects model interpretation. To tackle this problem, we introduce the contrastive loss into few-shot classification for learning latent fine-grained structure in the embedding space. Furthermore, to overcome the drawbacks of random image transformation used in current contrastive learning in producing noisy and inaccurate image pairs (i.e., views), we develop a learning-to-learn algorithm to automatically generate different views of the same image. Extensive experiments on standard few-shot learning benchmarks demonstrate the superiority of our method.
BibTeX
@inproceedings{luo2021boosting,
  author = {Xu Luo and Yuxuan Chen and Liangjian Wen and Lili Pan and Zenglin Xu},
  title = {{Boosting Few-Shot Classification with View-Learnable Contrastive Learning}},
  booktitle = {ICME},
  year = {2021},
  url = {https://openreview.net/forum?id=K8wrIHflBg},
}
Figure