Aligning Visual Prototypes with BERT Embeddings for Few-Shot Learning

Kun Yan, Zied Bouraoui, Ping Wang, Shoaib Jameel, Steven Schockaert

Abstract

Few-shot learning (FSL) aims to recognize new categories from very few examples. This paper enhances FSL by incorporating class names as prior knowledge, using BERT embeddings to capture rich semantic relationships. By decoupling visual and textual prototypes and aligning them through a novel correlation-based dimensionality reduction strategy, the authors achieve new state-of-the-art results on standard image classification benchmarks.

Introduction: The Challenge of Few-Shot Learning

Few-shot learning is often considered the "holy grail" of computer vision: teaching a model to recognize a new category (like a specific rare bird) after seeing only one or five examples. The core challenge is that with so few images, the model might focus on the wrong features—like the background instead of the bird’s beak.

Humans overcome this by leveraging prior knowledge. If someone tells you a "catamaran" is a type of boat, you already have a mental prototype before seeing one. Previous AI research tried to use "word embeddings" (like GloVe) to provide this context, but these models often struggled because standard word vectors group things by topic (e.g., "catamaran" near "snorkel") rather than category (e.g., "catamaran" near "boat"). Furthermore, previous models tried to force text embeddings to directly predict visual features, a rigid mapping that is difficult to learn with limited data.

Proposed Methodology

The authors propose a three-pronged approach to address these limitations:

  1. BERT for Semantics: Instead of static GloVe vectors, the model utilizes the BERT language model. Embeddings are extracted by feeding BERT thousands of sentences containing the class name and either masking the name or averaging its tokens. This captures nuanced, taxonomic information.
  2. Decoupled Prototypes: Rather than forcing a text vector to transform into a visual one, they are treated as separate entities. The final classification score combines the image's distance to a visual prototype (the average of the few available training images) and its similarity to a textual prototype.
  3. Correlation Exploration Module (CEM): BERT vectors are high-dimensional (1024D), which can lead to overfitting. The authors use Canonical Correlation Analysis (CCA) to find a low-dimensional subspace (e.g., 50D) where text and visual features are most highly correlated. A "de-whitening" step (CCA+D) is introduced to restore the original variance of the data, further boosting performance.
The proposed framework aligns visual features and class name embeddings through a Correlation Exploration Module.

Key Insights: Taxonomy over Topology

A critical finding is that BERT is significantly better than GloVe for FSL because it understands taxonomic relationships. While GloVe might associate a "house finch" with "ladybugs" or "triceratops" due to general context, BERT correctly identifies it as a bird.

Comparison of nearest neighbors for different word embeddings, showing BERT's superior taxonomic alignment.

By not forcing the text to "become" vision, the model gains flexibility, using text as a "hint" or a "margin" rather than a strict template. Using CCA to reduce dimensionality acts as a regularizer, forcing the model to ignore irrelevant parts of the BERT embedding (like phonetics) and focus on features that correlate with visual recognition.

Experimental Results

The model was evaluated on three standard FSL benchmarks: miniImageNet, tieredImageNet, and CUB (Caltech-UCSD Birds). The proposed method consistently improved the performance of various "base" models:

  • miniImageNet: On 5-way 5-shot tasks, the approach pushed ProtoNet from 74.28% to 79.37% accuracy.
  • State-of-the-Art: Combined with the DeepEMD backbone, it achieved 83.68% on miniImageNet and 87.51% on tieredImageNet, outperforming previous methods like AM3 and TRAML.
  • Fine-Grained Success: On the CUB dataset, the model reached 87.20% accuracy, proving that semantic knowledge is powerful for distinguishing subtle visual differences between bird species.

Limitations and Future Work

The method's success depends on meaningful class names and the availability of a large "bag of sentences" for each class to generate embeddings. In niche domains with alphanumeric codes or limited text data, performance might degrade. Future work could involve using more descriptive text, such as Wikipedia definitions, to provide even richer prior knowledge.

Summary updated

BibTeX
@inproceedings{yan2021aligning,
  author = {Kun Yan and Zied Bouraoui and Ping Wang and Shoaib Jameel and Steven Schockaert},
  title = {{Aligning Visual Prototypes with BERT Embeddings for Few-Shot Learning}},
  booktitle = {ICMR},
  year = {2021},
  url = {https://openreview.net/forum?id=94z0ExJve2l},
}
Figure