Matching Feature Sets for Few-Shot Image Classification

Arman Afrasiyabi, Hugo Larochelle, Jean-François Lalonde, Christian Gagné

Abstract

Few-shot image classification typically relies on compressing images into single monolithic feature vectors, creating a representational bottleneck. This paper introduces SetFeat, a framework that represents images as sets of feature vectors. By embedding lightweight self-attention mappers throughout a convolutional backbone and employing set-to-set matching metrics, SetFeat captures multi-scale, diverse visual characteristics. Experimental results on miniImageNet, tieredImageNet, and CUB show that SetFeat achieves state-of-the-art performance while maintaining parameter parity with standard backbones.

1. Introduction

In few-shot learning, models must generalize from extremely limited data. The prevailing paradigm involves mapping an image to a single point in an embedding space. However, this "single-vector" approach often discards fine-grained details and multi-scale information crucial for identifying novel classes. SetFeat addresses this by treating an image as a collection of distinct features, allowing for a more nuanced comparison between query and support sets.

2. The SetFeat Framework

SetFeat modifies standard convolutional neural networks (CNNs) to produce a set of $M$ feature vectors rather than a single output.

2.1 Attention-based Mappers

The core innovation is the "mapper"—a shallow, single-head self-attention module. These mappers are distributed across different blocks of the backbone (e.g., ResNet12). This distribution allows the model to capture features at various levels of abstraction, from low-level textures in early layers to high-level semantic parts in later layers.

The SetFeat architecture (a) extracts a set of feature vectors using attention-based mappers (b) distributed across convolutional blocks.

2.2 Parameter Efficiency

To ensure a fair comparison with existing methods, the authors reduce the number of convolution kernels in the base network. This adjustment keeps the total parameter count of SetFeat equivalent to the original backbone, proving that the performance gains come from the architectural shift rather than simply increasing model capacity.

3. Set-to-Set Matching

Unlike traditional methods that use Euclidean or Cosine distance on single vectors, SetFeat employs set-matching metrics to compare a query image to a support class.

Comparison between standard single-vector baseline methods (a) and the proposed SetFeat matching approach (b) using sum-min distance.

The most effective metric identified is Sum-min. For each feature in the query set, the model finds the closest match in the support set and sums these minimum distances. This non-linear matching encourages mappers to specialize in disjoint, non-overlapping representations, capturing a more holistic understanding of the scene.

4. Key Results and Insights

SetFeat demonstrates significant improvements across major benchmarks, achieving state-of-the-art results:

  • miniImageNet: Gained +1.83% (1-shot) and +1.4% (5-shot) accuracy over strong baselines.
  • tieredImageNet: Improved by +1.42% (1-shot) and +0.51% (5-shot).
  • CUB: Achieved +1.83% (1-shot) and +2.04% (5-shot) compared to previous best models.

Ablation studies confirmed that multi-scale features are consistently useful; low-level feature mappers are activated just as frequently as high-level ones during matching. Furthermore, saliency maps reveal that while single-vector models focus on one highly discriminative region, SetFeat's mappers jointly attend to multiple relevant parts of the image.

5. Conclusion and Future Work

SetFeat offers a robust alternative to the single-vector bottleneck in few-shot learning. By leveraging multi-scale features and non-linear set matching, it achieves state-of-the-art results with high parameter efficiency. Future research may explore weighted set-to-set matching metrics to dynamically assign importance to specific mappers or apply this set-based feature extraction to self-supervised learning tasks.

Summary updated

BibTeX
@inproceedings{afrasiyabi2022matching,
  author = {Arman Afrasiyabi and Hugo Larochelle and Jean-François Lalonde and Christian Gagné},
  title = {{Matching Feature Sets for Few-Shot Image Classification}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2022},
  doi = {10.1109/cvpr52688.2022.00881},
}
Figure