Composing Text and Image for Image Retrieval - an Empirical Odyssey

Nam Vo, Lu Jiang, Chen Sun, Kevin Murphy, Li-Jia Li, Li Fei-Fei, James Hays · DOI

Introduction

Image retrieval has traditionally been divided into two distinct paradigms: keyword-based search and visual similarity search. However, real-world human search behavior is often iterative and multi-modal. A user might find a reference image but wish to specify modifications, such as "this dress, but with a floral pattern" or "these shoes in suede." This paper addresses the challenge of retrieving images using a hybrid query composed of a reference image and a natural language modification string.

Figure 1: Examples of image retrieval tasks using a reference image and text-based modifications across different domains, including the CSS synthetic dataset.

The core technical hurdle lies in cross-modal feature composition: effectively combining high-dimensional image features with text features into a single query vector within the target image feature space. Unlike simple fusion techniques like concatenation, the authors propose a method that explicitly models text as a transformation operator.

The TIRG Architecture

The authors introduce Text Image Residual Gating (TIRG), a novel architecture designed to treat text as a "walk" or modification within the image feature space. The model consists of three primary components:

  1. Feature Extraction: A CNN (specifically ResNet-17) extracts visual features from the reference image, while an LSTM processes the modification text.
  2. Gating Mechanism: A sigmoid-based gating function determines which elements of the original image feature should be preserved.
  3. Residual Branch: This branch learns the "delta"—the specific change described by the text—which is then added to the gated image feature.
Figure 2: The TIRG architecture overview, illustrating how image and text features are composed via a gated residual connection to form a query vector in the image feature space.

By utilizing a residual design, TIRG treats the input image as a stable reference point. This approach simplifies the learning process, as the model only needs to capture the difference between the query and the target rather than synthesizing an entirely new representation from scratch.

Experimental Evaluation

TIRG was evaluated across three diverse benchmarks, demonstrating superior performance over existing methods like FiLM and Relationship Networks:

  • Fashion-200k: A real-world product dataset where queries involve attribute changes (e.g., "black jacket" to "leather jacket"). TIRG achieved a 14.1% Recall@1, nearly doubling the performance of previous specialized models (6.3%).
  • MIT-States: A dataset focused on object states (e.g., "ripe" vs. "rotten"). TIRG set a new state-of-the-art for compositional classification with 15.2% accuracy.
  • CSS (Color, Shape, Size): A synthetic dataset based on the CLEVR framework, designed for complex, multi-word spatial modifications. In a challenging "2D-to-3D" retrieval task, TIRG reached 46.6% R@1, significantly outperforming FiLM (43.7%) and simple concatenation (27.3%).

Key Insights and Conclusion

The empirical results highlight that treating text as a transformation (via residuals) is fundamentally more effective for retrieval than treating it as a co-equal input (via concatenation). Furthermore, the authors found that the optimal placement of the TIRG module depends on the nature of the modification: localized spatial changes benefit from application at convolutional layers, while abstract global changes are better handled at the final fully-connected layers.

While TIRG demonstrates significant improvements, limitations remain. Reconstructing images from TIRG features results in blurry outputs, suggesting the embeddings are optimized for discrimination rather than fine-grained visual detail. Future work will involve testing the architecture against more unconstrained, "in-the-wild" natural language and scaling the approach to massive commercial datasets.

Summary updated

BibTeX
@inproceedings{vo2019composing,
  author = {Nam Vo and Lu Jiang and Chen Sun and Kevin Murphy and Li-Jia Li and Li Fei-Fei and James Hays},
  title = {{Composing Text and Image for Image Retrieval - an Empirical Odyssey}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2019},
  doi = {10.1109/cvpr.2019.00660},
}
Figure