Sparse Spatial Transformers for Few-Shot Learning

27 Sep 2021  ·  Haoxing Chen, Huaxiong Li, Yaohui Li, Chunlin Chen ·

Learning from limited data is challenging because data scarcity leads to a poor generalization of the trained model. A classical global pooled representation will probably lose useful local information. Many few-shot learning methods have recently addressed this challenge using deep descriptors and learning a pixel-level metric. However, using deep descriptors as feature representations may lose image contextual information. Moreover, most of these methods independently address each class in the support set, which cannot sufficiently use discriminative information and task-specific embeddings. In this paper, we propose a novel transformer-based neural network architecture called sparse spatial transformers (SSFormers), which finds task-relevant features and suppresses task-irrelevant features. Particularly, we first divide each input image into several image patches of different sizes to obtain dense local features. These features retain contextual information while expressing local information. Then, a sparse spatial transformer layer is proposed to find spatial correspondence between the query image and the full support set to select task-relevant image patches and suppress task-irrelevant image patches. Finally, we propose using an image patch-matching module to calculate the distance between dense local representations, thus determining which category the query image belongs to in the support set. Extensive experiments on popular few-shot learning benchmarks demonstrate the superiority of our method over state-of-the-art methods. Our source code is available at \url{https://github.com/chenhaoxing/ssformers}.

PDF Abstract
Task Dataset Model Metric Name Metric Value Global Rank Result Benchmark
Few-Shot Image Classification CIFAR-FS 5-way (1-shot) SSFormers Accuracy 74.5 # 28
Few-Shot Image Classification CIFAR-FS 5-way (5-shot) SSFormers Accuracy 86.61 # 26
Few-Shot Image Classification FC100 5-way (1-shot) SSFormers Accuracy 43.72 # 16
Few-Shot Image Classification FC100 5-way (5-shot) SSFormers Accuracy 58.92 # 16
Few-Shot Image Classification Mini-Imagenet 5-way (1-shot) SSFormers Accuracy 67.25 # 43
Few-Shot Image Classification Mini-Imagenet 5-way (5-shot) SSFormers Accuracy 82.75 # 33
Few-Shot Image Classification Tiered ImageNet 5-way (1-shot) SSFormers Accuracy 72.52 # 24
Few-Shot Image Classification Tiered ImageNet 5-way (5-shot) SSFormers Accuracy 86.61 # 24

Methods