[Paper Review] Semantic Prompt for Few-Shot Image Recognition
Introduces Semantic Prompt (SP) to adaptively tune visual feature extractors for few-shot image recognition using textual prompts from class names, achieving gains over baselines on four benchmarks.
Few-shot learning is a challenging problem since only a few examples are provided to recognize a new class. Several recent studies exploit additional semantic information, e.g. text embeddings of class names, to address the issue of rare samples through combining semantic prototypes with visual prototypes. However, these methods still suffer from the spurious visual features learned from the rare support samples, resulting in limited benefits. In this paper, we propose a novel Semantic Prompt (SP) approach for few-shot learning. Instead of the naive exploitation of semantic information for remedying classifiers, we explore leveraging semantic information as prompts to tune the visual feature extraction network adaptively. Specifically, we design two complementary mechanisms to insert semantic prompts into the feature extractor: one is to enable the interaction between semantic prompts and patch embeddings along the spatial dimension via self-attention, another is to supplement visual features with the transformed semantic prompts along the channel dimension. By combining these two mechanisms, the feature extractor presents a better ability to attend to the class-specific features and obtains more generalized image representations with merely a few support samples. Through extensive experiments on four datasets, the proposed approach achieves promising results, improving the 1-shot learning accuracy by 3.67% on average.
Motivation & Objective
- Motivate leveraging semantic information to improve feature extraction in few-shot learning.
- Develop a method to inject semantic prompts into visual feature extractors along spatial and channel dimensions.
- Showthat semantic prompts improve generalization for novel classes with limited support data.
Proposed method
- Pre-train a Vision Transformer-based feature extractor on base classes with a linear head.
- Extract semantic features from class names using a pre-trained language/text encoder (e.g., CLIP, SBERT, GloVe).
- Incorporate semantic prompts into the feature extractor via two mechanisms: spatial interaction by extending patch sequence with a semantic token and processing through Transformer self-attention; channel interaction by concatenating semantic prompts with visual context and modulating features with an MLP-based beta vector.
- Compute class prototypes using features conditioned on semantic prompts and optimize with a meta-learning objective that maximizes cosine similarity between query features and prototypes.
- Evaluate across four datasets (mini ImageNet, tiered ImageNet, CIFAR-FS, FC100) with 1-shot and 5-shot settings, using CLIP-based prompts as default text encoder.
Experimental results
Research questions
- RQ1Can semantic information from class names, used as prompts, improve the discriminative quality of visual features in few-shot learning?
- RQ2Do spatial and channel-level interactions with semantic prompts complement each other to enhance generalization to novel classes?
- RQ3What is the impact of prompt placement layers and backbone choice on few-shot performance?
- RQ4How do different text encoders (CLIP, SBERT, GloVe) affect SP performance in 1-shot and 5-shot regimes?
Key findings
- SP improves 1-shot accuracy by an average of 3.67% across four benchmarks.
- Both spatial interaction (SI) and channel interaction (CI) contribute significant gains; combining them yields the best results.
- CLIP-based text prompts generally outperform SBERT and GloVe prompts in 1-shot settings.
- Using Visformer as backbone with SP substantially outperforms several baselines and prior semantic-methods on mini ImageNet and tiered ImageNet.
- Prompt placement at higher layers yields better results; a layer3-2 placement is effective across datasets.
- The average pooling of features across patches (vs. just the prompt position) is important for performance stability.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.