Abstract
Few-shot learning (FSL) aims to classify novel categories with minimal labeled examples. While Prototypical Networks have established a strong baseline by using class means in an embedding space, they suffer from spatial blindness due to standard CNN architectures and susceptibility to outliers in the support set. This paper proposes an improved framework that replaces standard convolutional embeddings with Capsule Networks to preserve spatial hierarchies and introduces an Attentive Prototype mechanism to weight support samples based on query relevance. Additionally, a generalized triplet-like loss is employed to enhance feature discriminability. Experimental results on miniImageNet, tieredImageNet, and FC100 demonstrate significant accuracy improvements and superior efficiency compared to traditional ResNet-based models.
Introduction
Few-shot learning (FSL) is a critical challenge in computer vision, requiring models to generalize from a very limited number of training examples—often just one to five per class. The Prototypical Network is a widely adopted baseline that maps images into a feature space where each class is represented by its centroid, or "prototype." However, this approach has two primary limitations. First, the underlying Convolutional Neural Networks (CNNs) often fail to capture the spatial relationships between object parts, a phenomenon known as spatial blindness. Second, simple averaging of support samples to form a prototype is highly sensitive to outliers; a single atypical image can significantly shift the prototype, leading to misclassification.
Methodology
The authors introduce a novel architecture that integrates Capsule Networks with an attentive prototypical learning strategy to overcome the limitations of traditional FSL models.
Capsule Network Embedding
Instead of standard CNNs, the model utilizes a modified DeepCaps architecture. Unlike scalar-valued neurons in CNNs, capsules use vectors to represent features. The length of a capsule vector indicates the probability of a feature's presence, while its orientation encodes "instantiation parameters" such as pose, texture, and position. This vector-based representation allows the network to maintain part-whole relationships, making it more robust to changes in orientation and spatial arrangement.
Attentive Prototypes
The standard approach of calculating a simple mean for prototypes assumes all support samples are equally representative. The proposed method replaces this with a query-dependent weighted average. By applying a normalized Gaussian function, the model calculates "membership" values for each support sample relative to the query image. Support samples that are more similar to the query (indicated by lower reconstruction error) receive higher weights. This "attentive" mechanism effectively filters out outliers that are irrelevant to the current classification task.
Improved Triplet-like Loss
To further refine the embedding space, the authors generalized the traditional triplet loss. While standard triplet loss compares a query to one positive and one negative sample, the improved version allows for simultaneous comparison against multiple negative prototypes within a single mini-batch. This forces the model to learn more discriminative features, resulting in tighter class clusters.
Experimental Evaluation
The model was rigorously tested on three standard benchmarks:
- miniImageNet: 100 classes with 600 images each.
- tieredImageNet: A larger set of 608 classes with a more challenging split between training and testing categories.
- Fewshot-CIFAR100 (FC100): A challenging version of CIFAR-100 designed for few-shot tasks.
Results and Discussion
The proposed method consistently outperformed baseline Prototypical Networks and several state-of-the-art (SOTA) approaches. On the 5-way, 5-shot miniImageNet task, accuracy improved from 75.21% to 80.17%, reaching 82.13% with data augmentation. Similar gains were observed across tieredImageNet (+4.83%) and FC100 (+2.5%).
Beyond accuracy, the model demonstrates impressive efficiency. Despite the perceived complexity of Capsule Networks, the architecture uses only 7.22 million parameters—significantly fewer than the 33.16 million parameters in typical ResNet-18 models. Inference is also faster, clocked at 1.67ms per image compared to 3.65ms for ResNet-based alternatives. Visual analysis via t-SNE confirms that capsule-based embeddings produce more compact and separable clusters than traditional methods.
Conclusion and Future Work
By combining the spatial awareness of Capsule Networks with a query-sensitive prototype mechanism, this research provides a more robust and efficient path for few-shot learning. Future work could explore scaling the attentive mechanism to "many-shot" scenarios where the support set is much larger, and optimizing dynamic routing for higher-resolution images. Additionally, the use of reconstruction error as a confidence metric for out-of-distribution detection remains a promising avenue for enhancing model reliability.
Summary updated