Word2Pix: Word to Pixel Cross Attention Transformer in Visual Grounding

Heng Zhao, Joey Tianyi Zhou, Yew-Soon Ong

TL;DR

Word2Pix is a novel one-stage visual grounding model that uses a transformer architecture to enable "word-to-pixel" attention. By treating each word in a query as an independent query to the image pixels, it prevents critical relational words (like "under" or "on") from being lost in a single sentence embedding, achieving state-of-the-art accuracy while maintaining real-time inference speeds.

What Problem Does This Paper Address?

Visual grounding, or referring expression comprehension, is the task of locating a specific object in an image based on a natural language description (e.g., "the cat sitting under the chair").

Current approaches generally fall into two camps:

  1. Two-stage methods: These first generate object proposals using a pre-trained detector and then rank them based on the text. While accurate, they are slow and limited by the quality of the initial proposals.
  2. One-stage methods: These are faster and end-to-end, but they typically compress the entire text query into a single "holistic" sentence vector.

The authors identify a major flaw in one-stage methods: information dilution. When a whole sentence is merged into one vector, subtle but critical words—like "under" vs. "on"—can be ignored in favor of dominant nouns like "cat" or "chair." This leads to errors when the scene contains multiple similar objects in different spatial relationships.

Methods

Word2Pix introduces a transformer-based encoder-decoder architecture to solve the dilution problem.

  • Visual Encoding Branch: A CNN (ResNet-101) extracts image features, which are then flattened and processed by a Transformer Encoder. This encoder uses self-attention to refine the visual features, making them "spatial-context-aware."
  • Word to Pixel Attention Branch: This is the core innovation. Instead of a single sentence vector, the model feeds individual word embeddings (from BERT or a learned matrix) into a Transformer Decoder.
  • Cross-Modal Attention: In the decoder, each word token acts as a query that attends to the visual pixel features. This allows every word to independently influence the visual search. For example, the word "under" can specifically guide the model's attention to regions below a "chair."
  • Multi-Task Prediction: The final representation of a special [CLS] token is used not just for bounding box regression, but also for predicting the object's category and attributes, providing richer semantic supervision during training.
Conceptual comparison: (a) standard sentence-level attention vs. (b) Word2Pix's word-to-pixel attention.

Datasets

The model was evaluated on three standard visual grounding benchmarks:

  • RefCOCO: Contains short, simple descriptions.
  • RefCOCO+: Descriptions avoid absolute location words (e.g., "left"), forcing the model to rely on appearance and relative relationships.
  • RefCOCOg: Features longer, more complex "University of Maryland" (umd) style descriptions.

Key Insights and Ideas

  • Equality for Words: By treating words as independent queries in the transformer decoder, the model ensures that small but vital words (prepositions, attributes) have an "equivalent opportunity" to adjust the visual attention.
  • End-to-End Advantage: Unlike two-stage models that use frozen detectors, Word2Pix allows the CNN backbone to be fine-tuned. This is crucial for recognizing class-agnostic features like specific poses or colors that standard detectors might ignore.
  • Robustness to Subtle Changes: Qualitative results show that Word2Pix can distinguish between "cat under the chair" and "cat on the chair" much more reliably than models using holistic sentence embeddings.

Key Results

Word2Pix sets a new state-of-the-art for one-stage methods and even outperforms many complex two-stage models:

  • Accuracy: On RefCOCO+, it achieved 76.81% on the testA set, a significant ~6.5% leap over previous one-stage leaders.
  • Speed: It maintains a real-time inference speed of 29ms per image, which is roughly 10x faster than leading two-stage models like MAttNet (~320ms).
  • Ablation Study: The authors proved that using individual word tokens in the decoder is strictly superior to using multiple sentence-level embeddings from BERT.

Limitations and Future Work

While powerful, the authors note a few challenges:

  • Training Convergence: Transformer-based models can be slow to converge during the training phase.
  • Complex Syntax: While better at handling relationships, extremely long and syntactically complex sentences still pose a challenge.
  • Future Directions: The authors suggest exploring more sophisticated ways to model the internal structure of the query sentence within the transformer framework.

Summary updated

BibTeX
@article{zhao2024word,
  author = {Heng Zhao and Joey Tianyi Zhou and Yew-Soon Ong},
  title = {{Word2Pix: Word to Pixel Cross Attention Transformer in Visual Grounding}},
  journal = {IEEE Trans. Neural Networks Learn. Syst.},
  year = {2024},
  doi = {10.1109/tnnls.2022.3183827},
}
Figure