Text2Model: Text-based Model Induction for Zero-shot Image Classification

Ohad Amosy, Tomer Volk, Eilam Shapira, Eyal Ben-David, Roi Reichart, Gal Chechik

Abstract

Text2Model (T2M) introduces a novel paradigm for zero-shot image classification by inducing task-specific discriminative models on the fly. Unlike traditional methods that map images and text to a static shared space, T2M utilizes a permutation-equivariant hypernetwork to generate classifier weights directly from textual descriptions. This approach enables the model to adapt to specific task contexts and handle complex linguistic queries, including negative attributes, significantly outperforming existing zero-shot learning baselines.

Introduction

Traditional Zero-Shot Learning (ZSL) usually relies on a "shared space" approach: images and text labels are mapped to the same vector space, and classification happens via a nearest-neighbor search. However, this paradigm suffers from two major flaws: query-independence and restricted language richness.

Because representations are "frozen" after training, static models cannot adapt to the specific context of a task. For example, the features needed to distinguish a "furry toy" from a "plastic toy" are different from those needed to distinguish a "furry toy" from a "real dog." Furthermore, most ZSL models fail when descriptions get complex, particularly with negative attributes (e.g., "an animal without fur").

Figure 1: Comparison between traditional shared-space methods and the proposed Text-to-model approach. T2M generates a task-specific classifier on the fly, allowing for better discrimination based on the provided query.

Methodology: The T2M-HN Architecture

The core innovation of this work is the Text-to-Model Hypernetwork (T2M-HN). Instead of outputting a vector embedding, this system outputs the actual weights ($w$) of a downstream classifier tailored to the input text.

The Pipeline

A pretrained text encoder (such as SBERT) processes class descriptions into dense descriptors. These are fed into a Hypernetwork (HN), which generates the weights for an "on-demand" classifier. This classifier then processes the input image to produce a final prediction.

Figure 4: The T2M-HN pipeline. A text encoder processes class descriptions into descriptors, which a hypernetwork uses to generate weights $w$ for an on-demand image classifier $f(x; w)$.

Symmetry and Equivariance

A key technical contribution is the design of the hypernetwork using permutation-equivariant and invariant layers. This ensures that if the order of input text descriptions is swapped (e.g., "Cat, Dog" vs. "Dog, Cat"), the generated classifier remains consistent, with only a corresponding swap in its output layers. This inductive bias acts as a powerful regularizer that improves generalization to unseen classes.

Key Results and Insights

The authors tested T2M across diverse modalities, including images (AwA, SUN, CUB), 3D point clouds (ModelNet40), and action recognition (BABEL 120).

  • State-of-the-Art Performance: T2M-HN outperformed all baselines across almost every dataset. On AwA (unseen classes), T2M achieved 87.3% accuracy, compared to the best baseline's 81.6%. On ModelNet40 (3D), it reached 75.1%, significantly higher than the 68.6% of previous SOTA.
  • Task-Specific Features: By generating the model at inference time, T2M can "focus" on the attributes that matter for the current set of classes. Grad-CAM visualizations show that the model dynamically shifts its focus based on the contrastive set of classes provided.
  • Handling Negatives: Foundational models like CLIP and GPT-4Vision struggle with negative descriptions (e.g., "animals that do not fly"). T2M handles these significantly better because it is explicitly trained to find discriminative boundaries based on the provided text.

Discussion and Limitations

While T2M shows remarkable strength, it can be misled by text that lacks a visual counterpart. If a description includes non-visual terms like "endangered species," the model may attempt to find a visual feature for "endangered-ness," leading to noise. Additionally, hypernetworks can be more difficult to train than standard architectures. Future work will explore better filtering of non-visual information and extending this approach to even more diverse modalities.

Summary updated

BibTeX
@inproceedings{amosy2024text,
  author = {Ohad Amosy and Tomer Volk and Eilam Shapira and Eyal Ben-David and Roi Reichart and Gal Chechik},
  title = {{Text2Model: Text-based Model Induction for Zero-shot Image Classification}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.findings-emnlp.8},
}
Figure