Finding beans in burgers: Deep semantic-visual embedding with localization

Martin Engilberge, Louis Chevallier, Patrick Pérez, Matthieu Cord

TL;DR

This paper introduces a novel dual-path neural network architecture that maps images and text into a shared semantic embedding space. By leveraging advanced space-aware pooling mechanisms, the model achieves state-of-the-art performance in cross-modal retrieval and introduces a built-in, weakly supervised mechanism to accurately localize arbitrary textual concepts within images without requiring explicit region proposal networks.

What Problem Does This Paper Address?

Deep learning has excelled at creating separate, high-quality representations for text and images. A major frontier in multi-modal AI is building a shared embedding space where an image and its textual description sit close together geometrically.

While existing models can successfully match a caption to an entire image, localizing specific phrases within that image (e.g., finding the "beans" inside a "burger") typically requires a cumbersome, two-step process. First, an external region proposal network extracts hundreds of bounding boxes; then, the model calculates the similarity for each box. The authors of this paper sought a unified, elegant alternative: a model that learns global image-text alignments but inherently understands where specific concepts reside spatially, using nothing but standard image-caption pairs for training (weak supervision).

Methods

The authors propose a dual-path architecture that maps both modalities into a shared $d$-dimensional space ($d=2400$).

Figure 2. Two-path multi-modal embedding architecture. Im- ages of arbitrary size and text of arbitrary length pass through ded- icated neural networks to be mapped into a shared representation vector space. The visual path (blue) is composed of a fully con- volutional neural network (ResNet in experiments), followed by a convolutional adaptation layer, a pooling layer that aggregates pre- vious feature maps into a vector and a final projection to the final output space; The textual path (orange) is composed of a recurrent net running on sequences of text tokens individually embedded with an off-the-shelf map (word2vec in experiments).
  • The Visual Path: Images are processed through a fully convolutional ResNet-152 network. Instead of standard global average pooling, the authors employ a $1 \times 1$ convolution to project the features into $D'=2400$ maps, followed by WELDON pooling (selective spatial pooling with negative evidence). This pooling captures both the most positive and most negative spatial indicators for a concept, aggregating them into a robust vector.
  • The Textual Path: Sentences are tokenized, embedded via word2vec, and passed through a 4-layer Simple Recurrent Unit (SRU) trained from scratch.
  • Training with Hard Negatives: The network is optimized using a contrastive triplet ranking loss. Crucially, instead of comparing against random mismatching images/captions, the training pipeline actively mines for the hardest negatives within each mini-batch—the incorrect matches that the network is currently most confident about.

The Localization Trick

The true novelty shines during inference. By removing the pooling layer, the learned projection matrix can be applied as a $1 \times 1$ convolution directly over the unpooled visual feature maps. For any text query vector $v$, the model identifies its top $k$ largest entries and linearly combines the corresponding feature maps to output a 2D spatial heatmap.

Figure 4. From text embedding to visual localization. Given the feature maps G associated to an image by our semantic-visual architecture and the embedding of a sentence, a heatmap can be constructed: Learned projection matrix A serves as a 1 × 1 con- volution; Among the d maps thus generated, the k ones associated with the largest among the d entries of v are linearly combined. If the sentence relates to a part of the visual scene, like “two glasses” in this example, the constructed heatmap should highlight the cor- responding location. Blue dot indicates the heat maximum.

Datasets

The model was trained and benchmarked using several standard datasets:

  • MS-COCO: The primary dataset used for training and cross-modal retrieval evaluation, utilizing standard image-caption splits.
  • Visual Genome: Used exclusively to provide ground-truth bounding box annotations to evaluate the model's phrase localization accuracy via the "pointing game."
  • Flickr-30K: Used to evaluate the model's cross-dataset transferability in a zero-shot manner (without retraining).

Key Insights and Ideas

  • Implicit Spatial Awareness: Global image-caption alignment implicitly forces the network to learn fine-grained spatial correspondences. You do not need expensive bounding box annotations to teach a network where an object is.
  • Hard Negatives are Mandatory: Switching from random negative sampling to hard negative mining prevents gradient averaging and forces the embedding space to learn highly precise boundaries. Without it, retrieval performance plummets.
  • Zero-Shot Concept Grounding: Because the text path maps words into a continuous semantic space, the localization mechanism can ground concepts it has never explicitly seen in the image training captions (e.g., distinguishing "red car" vs "blue car" or identifying rare animals like a "caracal"), leveraging the geometric structure of the shared space.

Key Results

The proposed architecture achieved state-of-the-art results across two distinct tasks:

1. Cross-Modal Retrieval (MS-COCO)

The model significantly outperformed existing methods like VSE++.

  • Caption Retrieval (R@1): Achieved 69.8%, a substantial relative gain over previous online results.
  • Image Retrieval (R@1): Achieved 55.9%.

2. Visual Grounding / Pointing Game

When evaluated on the "pointing game" (where a prediction is correct if the maximum peak of the heatmap falls inside the object's bounding box), the model achieved 33.8% accuracy. This drastically beats the previous state-of-the-art linguistic structure model (24.4%) and a center-bias baseline (19.5%), all without ever being trained on bounding boxes.

Figure 1. Concept localization with proposed semantic-visual embedding. Not only does our deep embedding allows cross- modal retrieval with state-of-the-art performance, but it can also associate to an image, e.g., the hamburger plate on the left, a lo- calization heatmap for any text query, as shown with overlays for three text examples. The circled blue dot indicates the highest peak in the heatmap.

Limitations and Future Work

While powerful, the model exhibits a few limitations:

  • Hyperparameter Sensitivity: Performance is highly dependent on mini-batch size (optimally 160) and the number of top entries ($k=180$) selected to generate the localization heatmaps.
  • Input Resolution Dependency: The best visual results require resizing images to a large fixed square ($400 \times 400$) rather than traditional cropping, which alters aspect ratios but preserves global context.

For future work, the authors suggest exploring deeper integration of complex language structures (rather than relying primarily on sequential RNN encodings) to further improve zero-shot localization capabilities.

Summary updated

BibTeX
@inproceedings{engilberge2018finding,
  author = {Martin Engilberge and Louis Chevallier and Patrick Pérez and Matthieu Cord},
  title = {{Finding beans in burgers: Deep semantic-visual embedding with localization}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2018},
  url = {https://openreview.net/forum?id=By48qR-_WB},
}
Figure