Introduction
Few-shot image classification aims to recognize novel categories using only a limited number of labeled examples, known as the support set. A cornerstone of this field is the Prototypical Network, which represents each class by a single "prototype"—typically the mean feature vector of its support images. While effective, this "one-size-fits-all" approach suffers from three critical limitations: spatial misalignment between query and support images, scale mismatches where objects vary in size, and the inability of a fixed class mean to capture the specific nuances of a given query image.
To address these challenges, we present the Hierarchical Representation based Query-Specific Prototypical Network (QPN). Unlike traditional methods, QPN dynamically generates a unique prototype for every query image by aligning semantically relevant regions across multiple scales, establishing a new state-of-the-art for fine-grained classification.
Methodology
The QPN architecture is structured into four primary stages designed to enhance feature extraction and alignment:
1. Attention-Enhanced Embedding
The model utilizes a standard CNN backbone augmented with a Convolutional Block Attention Module (CBAM). This module applies both channel-wise and spatial-wise attention, allowing the network to prioritize "what" features are important and "where" they are located within the image frame.
2. Hierarchical Representation
To mitigate scale mismatch, QPN avoids relying on a single feature map level. Instead, it employs multi-scale pooling to generate a hierarchy of feature maps (ranging from $10 \times 10$ to $1 \times 1$). This hierarchical structure enables the model to match a large object in a query image with a smaller instance of the same object in a support image.
3. Prototype Generator (PG)
The core innovation of QPN is the Prototype Generator. For each local region in a query image, the PG identifies the $\xi$ most similar regions across the support images. It then computes a weighted sum of these regions to construct a query-specific prototype. This process effectively "reconstructs" the support class to match the pose and scale of the specific query image being evaluated.
4. Nonlinear Classifier
Rather than using simple Euclidean distance, the relationship between the query and its specific prototype is processed through a four-layer Multi-Layer Perceptron (MLP). This produces a similarity score that accounts for complex, non-linear feature interactions.
Key Insights and Results
Local Semantic Consistency
By focusing on "Fine-Grained Cells" (FGCs) rather than global averages, the model maintains semantic consistency even in the presence of cluttered backgrounds or partial occlusions. This local matching strategy is particularly powerful for fine-grained tasks where the differences between classes are subtle.
Performance Benchmarks
QPN was evaluated across five major benchmarks, showing significant improvements over existing metric-based methods:
- General Purpose: On miniImageNet (5-way, 1-shot), QPN achieved 54.92% accuracy.
- Fine-Grained Dominance: The model excelled in specialized datasets. On Stanford Dogs, it outperformed the previous state-of-the-art by 4.59% in 1-shot and 7.47% in 5-shot settings.
- Cross-Domain Robustness: When trained on miniImageNet and tested on CUB (Birds), QPN reached 66.19%, suggesting it learns transferable semantic alignment rather than simple texture memorization.
Conclusion and Future Work
The Query-Specific Prototypical Network demonstrates that dynamic, query-aligned prototypes are superior to fixed class averages for few-shot learning. While the multi-scale matching process introduces some computational overhead, the non-parametric nature of the Prototype Generator keeps the model efficient. Future research will explore the integration of deeper backbones, such as Vision Transformers, to further enhance the hierarchical feature extraction process.
Summary updated