Abstract
Few-Shot Learning (FSL) aims to recognize novel categories using only a handful of labeled examples. Central to this task is the development of a high-quality feature extractor. While contrastive learning has emerged as a powerful pre-training paradigm, current methods often overlook the nuanced differences between various types of sample relationships. We propose Multi-Grained Relation Contrastive Learning (MGRCL), which explicitly distinguishes between intra-sample, intra-class, and inter-class relations. By applying strict consistency constraints to identical samples and relative similarity constraints to class-level peers, MGRCL learns more discriminative and transferable features. Our approach achieves state-of-the-art results on several benchmarks, demonstrating particular strength in fine-grained classification tasks.
Introduction
The success of Few-Shot Learning (FSL) heavily relies on the feature representations learned during a large-scale pre-training phase. Contrastive learning techniques, such as Supervised Contrastive Learning (SupCon), have significantly improved these representations by pulling together samples of the same class and pushing apart those from different classes.
However, a critical "granularity" problem persists: standard contrastive methods often treat an image and its augmented version (e.g., a crop) with the same modeling objective as two distinct images from the same category. In reality, an image and its augmentation are semantically identical (intra-sample), whereas two different images of the same class are merely similar (intra-class). Treating these distinct relationships with the same "strictness" can lead to sub-optimal feature spaces.
Methodology: Multi-Grained Relation Contrastive Learning (MGRCL)
To address the granularity issue, MGRCL categorizes sample relations into three grains: intra-sample, intra-class, and inter-class. The framework utilizes two primary learning objectives to handle these relations differently.
Transformation Consistency Learning (TCL)
TCL focuses on the intra-sample grain. It enforces a strict semantic identity by ensuring that the model’s predicted label distributions remain consistent across different transformations of the same image. Instead of simple feature-level alignment, TCL minimizes the Jensen-Shannon Divergence between the probability distributions of augmented views. This approach uses the label distribution as a "semantic anchor," capturing how the model perceives an object's relationship to all known categories.
Class Contrastive Learning (CCL)
CCL targets intra-class and inter-class grains. It employs a Memory Bank to store features from the entire dataset, allowing for a broader context during training. Unlike the absolute consistency required by TCL, CCL applies a relative constraint: a sample's feature should be closer to its "homogenous" (same class) peers in the memory bank than to "inhomogeneous" (different class) ones. This allows the model to capture the natural variance within a class while maintaining clear boundaries between different categories.
Experimental Results
The MGRCL framework was evaluated on four standard FSL benchmarks: miniImageNet, tieredImageNet, CIFAR-FS, and CUB-200-2011.
Benchmark Performance
MGRCL consistently achieved state-of-the-art (SOTA) or near-SOTA performance:
- miniImageNet: Achieved 69.57% (1-shot) and 84.41% (5-shot) accuracy.
- CUB (Fine-grained): Reached a significant 86.14% in 1-shot tasks, outperforming existing methods by a notable margin. This suggests that the multi-grained approach is exceptionally effective when class differences are subtle.
Versatility as a Pre-training Strategy
A key finding is that MGRCL serves as an excellent "teacher" for other FSL algorithms. When used to pre-train popular models like FEAT or Meta-Baseline, it provided a consistent performance boost. For instance, it improved the 1-shot accuracy of Meta-Baseline on miniImageNet from 63.38% to 69.01%.
Discussion and Conclusion
By rethinking sample relations through the lens of granularity, MGRCL provides a more nuanced approach to feature learning for FSL. Separating "consistency" for identity from "similarity" for class membership prevents model collapse and leads to more discriminative feature representations. While the method introduces some computational overhead, its performance gains—especially in fine-grained scenarios—are substantial. Future work will focus on optimizing the memory bank for larger datasets and exploring advanced data augmentation techniques to further enhance feature richness.
Summary updated