Finding Task-Relevant Features for Few-Shot Learning by Category Traversal

Hongyang Li, David Eigen, Samuel Dodge, Matthew Zeiler, Xiaogang Wang

Abstract

Few-shot learning (FSL) typically treats categories in a task as isolated entities, extracting fixed features regardless of the specific classification context. We present the Category Traversal Module (CTM), a plug-and-play component that identifies task-relevant features by considering all available classes simultaneously. By finding features common within a class but unique across classes, CTM achieves significant performance gains on standard benchmarks like miniImageNet and tieredImageNet.

Introduction

Few-shot learning (FSL) aims to classify new objects given only a handful of examples, known as the support set. Most current metric-learning approaches extract features from a query image and compare them to features from support images. However, a major bottleneck in these models is that they typically treat each support class independently, extracting a fixed set of features regardless of the other classes present in the task.

The Problem: Context-Blindness in Feature Extraction

Standard models struggle to adapt to the "context" of a specific task. For example, if a task requires distinguishing between different types of green birds, the color "green" is a non-discriminative feature. Conversely, if the task is to distinguish a green bird from a red car, color becomes the primary feature. Standard models, which do not look at the entire task context, fail to prioritize features that are discriminative for the specific set of classes at hand.

Comparison between isolated feature extraction (a) and the proposed category traversal approach (b).

The Category Traversal Module (CTM)

To address this, the authors propose the Category Traversal Module (CTM). Instead of processing classes in isolation, CTM "traverses" the entire support set to identify task-specific dimensions. The module consists of three primary components:

  1. The Concentrator (Intra-class Commonality): This component identifies features shared within a single category. It uses a small CNN to reduce dimensions and averages samples to create a class "prototype."
  2. The Projector (Inter-class Uniqueness): This component compares prototypes across all classes in the task to identify which feature dimensions are most unique. It generates a task-specific mask ($p$).
  3. The Reshaper: A lightweight layer that aligns the mask dimensions with the original feature embeddings.

The resulting mask $p$ is applied via element-wise multiplication to the features of both the support set and the query image. This process effectively "zeros out" irrelevant features and amplifies discriminative ones before final classification.

Detailed architecture of the Category Traversal Module showing the flow from feature extraction to mask generation.

Experimental Results

The CTM was evaluated on two standard FSL benchmarks: miniImageNet and tieredImageNet.

  • Performance Gains: On miniImageNet, adding CTM to a standard Relation Network boosted 1-shot accuracy from approximately 58% to 62%, and 5-shot accuracy from 74% to 78%.
  • State-of-the-Art: Combined with a ResNet-18 backbone, CTM achieved 64.12% (1-shot) and 80.51% (5-shot) on miniImageNet, outperforming many contemporary models.
  • Versatility: CTM is a plug-and-play module that was successfully integrated into Matching Networks, Prototypical Networks, and Relation Networks, yielding consistent improvements.

Conclusion

The Category Traversal Module demonstrates that feature relevance is inherently task-dependent. By considering the global context of a classification task, CTM allows models to focus on the most discriminative features, significantly improving few-shot learning performance with minimal computational overhead.

Summary updated

BibTeX
@inproceedings{li2019finding,
  author = {Hongyang Li and David Eigen and Samuel Dodge and Matthew Zeiler and Xiaogang Wang},
  title = {{Finding Task-Relevant Features for Few-Shot Learning by Category Traversal}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2019},
  doi = {10.1109/cvpr.2019.00009},
}
Figure