Pixel-BERT: Aligning Image Pixels with Text by Deep Multi-Modal Transformers

Zhicheng Huang, Zhaoyang Zeng, Bei Liu, Dongmei Fu, Jianlong FuarXiv 2020

Abstract

Vision and Language (V+L) tasks have traditionally relied on a two-step pipeline involving pre-trained object detectors to extract regional features. However, this approach introduces significant information gaps and semantic bottlenecks. Pixel-BERT addresses these issues by proposing a unified, end-to-end framework that aligns visual and language semantics directly from raw image pixels. By utilizing a CNN-based visual encoder and a novel random pixel sampling mechanism within a deep Multi-Modal Transformer, Pixel-BERT achieves state-of-the-art performance on benchmarks such as VQA and NLVR².

Introduction: The Limitations of Region-Based Approaches

The prevailing paradigm in V+L research involves extracting visual features from specific bounding boxes using detectors like Faster R-CNN. While effective, this method suffers from three critical flaws:

  1. Information Loss: Bounding boxes are inherently rectangular and often capture irrelevant background noise while missing the precise spatial relationships and fine-grained shapes of objects.
  2. Semantic Bottlenecks: The visual representation is constrained by the predefined categories of the object detector. If a detector is not trained to recognize specific attributes like "texture" or "atmosphere," the downstream V+L model remains blind to these nuances.
  3. Annotation Dependency: High-quality bounding box annotations are expensive to produce, creating a data imbalance compared to the abundance of raw image-text pairs available online.

Pixel-BERT overcomes these hurdles by treating the image as a sequence of pixel-level features, allowing the model to learn visual representations that are dynamically optimized for the linguistic context.

Methodology: The Pixel-BERT Architecture

The core of Pixel-BERT is a "single-stream" architecture designed to process image pixels and text tokens as a unified sequence.

The Pixel-BERT architecture overview, illustrating the integration of the CNN-based visual encoder and the sentence encoder into a joint Transformer framework.

CNN-based Visual Encoder

Instead of isolating regions of interest, Pixel-BERT employs a CNN backbone (such as ResNet-50 or ResNeXt-152) to extract a comprehensive feature map from the entire image. This map is flattened into a sequence of visual tokens, preserving the global context and spatial dependencies that region-based models often discard.

Random Pixel Sampling

To manage the computational complexity of processing high-resolution feature maps and to improve model robustness, the authors introduce Random Pixel Sampling. During the pre-training phase, a subset of pixels is randomly sampled from the feature map. This technique serves as a powerful regularizer, forcing the Transformer to infer global semantics from incomplete visual information, much like how humans can recognize a scene from a few key details.

Cross-Modality Transformer

The visual tokens are concatenated with text tokens (processed via a standard BERT-style encoder) and fed into a deep Multi-Modal Transformer. This allows for early and dense interaction between the two modalities, enabling the model to learn complex cross-modal alignments.

Pre-training and Evaluation

Pixel-BERT is pre-trained on large-scale datasets like Visual Genome and MS-COCO using two primary self-supervised objectives:

  • Masked Language Modeling (MLM): The model predicts masked words in a sentence by leveraging both the surrounding text and the corresponding image pixels. Ablation studies indicate that MLM is critical for the model's convergence on reasoning tasks.
  • Image-Text Matching (ITM): The model learns to distinguish whether a specific image and sentence pair are semantically aligned through binary classification.

Key Results and Insights

The end-to-end nature of Pixel-BERT leads to significant performance improvements across various downstream tasks:

  • Visual Question Answering (VQA): Pixel-BERT outperformed previous state-of-the-art models by 2.17 points, demonstrating the benefit of pixel-level attention in answering complex queries.
  • Natural Language Visual Reasoning (NLVR²): The model achieved a test-P accuracy of 77.2%, proving its ability to reason about spatial and logical relationships without explicit object detection.
  • Image Retrieval: On the Flickr30K dataset, the model reached a Recall@1 of 87.0% for image-to-text retrieval, setting a new benchmark for the task.

By moving to pixel-level features, the model can attend to any part of the image, including backgrounds and complex shapes that do not fit neatly into a rectangle. Furthermore, because the CNN is part of the Transformer's training loop, the visual features themselves are optimized for the language task rather than being fixed features from a generic detector.

Conclusion

Pixel-BERT represents a significant shift in Vision and Language modeling. By removing the dependency on fixed object detectors and embracing end-to-end learning from raw pixels, the framework provides a more flexible and powerful way to align visual and textual information. While reconstructing raw pixels remains a challenge for future research, the current results demonstrate that a simpler, pixel-based input can outperform more complex, region-heavy architectures.

Summary updated

BibTeX
@misc{huang2020pixel,
  author = {Zhicheng Huang and Zhaoyang Zeng and Bei Liu and Dongmei Fu and Jianlong Fu},
  title = {{Pixel-BERT: Aligning Image Pixels with Text by Deep Multi-Modal Transformers}},
  year = {2020},
  eprint = {2004.00849},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2004.00849},
}
Figure