ESPT: A Self-Supervised Episodic Spatial Pretext Task for Improving Few-Shot Learning

Yi Rong, Xiongbo Lu, Zhaoyang Sun, Yaxiong Chen, Shengwu Xiong

Abstract

Few-shot learning (FSL) aims to recognize novel categories with minimal labeled examples, a task that remains challenging due to the risk of overfitting to base classes and the neglect of local spatial structures. We present the Episodic Spatial Pretext Task (ESPT), a self-supervised approach designed to enhance few-shot image classification. ESPT enforces consistency between the spatial relationships of query and support images across geometric transformations. By utilizing a ridge regression-based reconstruction of local features, the model learns highly transferable representations that generalize effectively to unseen domains. Experimental results demonstrate that ESPT achieves state-of-the-art performance across standard benchmarks, including miniImageNet, tieredImageNet, and CUB-200-2011, without introducing additional trainable parameters.

1. Introduction

Few-shot learning (FSL) addresses the challenge of training models to generalize from a limited number of labeled samples, typically through episodic training. In this paradigm, a model is trained on a series of mini-tasks consisting of a "support set" (labeled examples) and a "query set" (unlabeled test images). Despite its success, standard episodic training often leads to two significant bottlenecks: overfitting to the specific semantics of base classes and a reliance on global embeddings that ignore the rich, local spatial information inherent in images.

To mitigate these issues, we introduce the Episodic Spatial Pretext Task (ESPT). Unlike traditional self-supervised methods that operate on individual images in isolation, ESPT focuses on the inter-relationships within an entire episode. By emphasizing local feature consistency, the model captures structural data patterns that are more likely to be shared across disparate categories, thereby improving generalization to novel classes.

2. Methodology

2.1 The Two-Branch Architecture

ESPT utilizes a dual-branch framework. When presented with an episode, the model generates a "transformed" version of the entire task by applying a shared random geometric transformation (e.g., a 90-degree rotation) to every image in the support and query sets. Both the original and transformed episodes are processed through a shared backbone (ResNet-12) to extract local feature maps.

2.2 Ridge Regression-Based Reconstruction

Rather than relying on simple distance matching between global vectors, ESPT employs local feature reconstruction. The model attempts to reconstruct the local feature vectors of a query image using a linear combination of local features from the support images. This reconstruction is formulated as a ridge regression problem, which offers a differentiable, closed-form solution. This approach allows the model to explicitly model how different spatial regions of the query image relate to the available support data.

2.3 The ESPT Objective

The core of the methodology is the consistency loss. The model calculates the reconstruction coefficients—essentially the "recipe" for building a query image from support images—for both the original and transformed branches. The ESPT objective forces these two sets of coefficients to be as similar as possible. The underlying intuition is that if a task is transformed geometrically, the relative spatial relationships and the "recipe" for reconstruction should remain invariant. This self-supervised objective is optimized alongside the standard classification loss.

3. Experimental Results

3.1 Benchmarks and Performance

ESPT was evaluated on three primary benchmarks: miniImageNet, tieredImageNet, and the fine-grained CUB-200-2011 dataset. The model achieved new state-of-the-art (SOTA) results:

  • miniImageNet: Reached 68.36% (1-shot) and 84.11% (5-shot) accuracy.
  • tieredImageNet: Achieved 72.68% (1-shot), outperforming existing self-supervised FSL methods such as IEPT and InfoPatch.
  • CUB-200-2011: Reached 85.45% (1-shot), demonstrating superior capability in capturing the subtle spatial details required for fine-grained classification.

3.2 Cross-Domain Generalization

To test the robustness of the learned features, the model was trained on miniImageNet and tested on the CUB dataset. In this cross-domain setting, ESPT outperformed the nearest competing method by over 2.5% in the 1-shot scenario, confirming that local spatial consistency is a powerful signal for domain-agnostic feature learning.

4. Discussion and Conclusion

ESPT offers a highly efficient solution for few-shot learning. Unlike many contemporary SOTA methods that rely on complex attention mechanisms or Transformers, ESPT achieves superior performance without adding any extra trainable parameters. This efficiency stems from its focus on the "data structure" of the task itself through episodic supervision.

While effective, the current implementation is limited to geometric transformations that preserve spatial alignment. Future research may explore more complex augmentations, such as non-linear warps or heavy cropping, to further enhance the robustness of the spatial reconstruction logic. In conclusion, ESPT demonstrates that enforcing episodic spatial consistency is a vital step toward more human-like, generalized visual recognition.

Summary updated

BibTeX
@inproceedings{rong2023espt,
  author = {Yi Rong and Xiongbo Lu and Zhaoyang Sun and Yaxiong Chen and Shengwu Xiong},
  title = {{ESPT: A Self-Supervised Episodic Spatial Pretext Task for Improving Few-Shot Learning}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.1609/aaai.v37i8.26148},
}
Figure