RelTR: Relation Transformer for Scene Graph Generation

Yuren Cong, Michael Ying Yang, Bodo Rosenhahn

TL;DR

RelTR introduces a one-stage, end-to-end framework for Scene Graph Generation (SGG) based on the Transformer architecture. By treating SGG as a set prediction problem with coupled subject-object queries, it bypasses the computationally expensive $O(n^2)$ pair-matching of traditional two-stage methods. This results in a lightweight model that generates sparse, high-quality scene graphs up to 7 times faster than competitive baselines.

What Problem Does This Paper Address?

Scene Graph Generation (SGG) aims to identify objects (entities) in an image and map their relationships into a graph of <subject-predicate-object> triplets. This is crucial for downstream vision-language tasks like image retrieval and visual question answering.

Traditional SGG approaches rely on a two-stage pipeline: first, an object detector generates $n$ object proposals; second, a relationship classifier evaluates the edges between all possible pairs. This creates an $O(n^2)$ computational bottleneck, requiring dense relationship labeling and massive parameter overhead. Furthermore, these models often suffer from semantic bias, relying heavily on statistical priors (e.g., predicting "wearing" simply because the subject is a person and the object is pants) rather than actual visual appearance.

Comparison between traditional two-stage methods and the proposed one-stage sparse prediction method.

Methods

RelTR addresses these challenges by framing SGG as a direct set prediction task inspired by the Detection Transformer (DETR). The core architecture consists of:

  • Feature Encoder & Entity Decoder: Standard components that extract global visual context and entity representations from a CNN backbone.
  • Triplet Decoder: A novel architecture featuring parallelized subject and object branches. It utilizes Coupled Self-Attention (CSA) to allow subject and object queries to interact and establish relationship context.
  • Decoupled Visual Attention (DVA) & Decoupled Entity Attention (DEA): These modules independently refine spatial and semantic features for subjects and objects, bridging the gap between entity detection and triplet generation.
  • Set Prediction Loss: RelTR uses bipartite matching (via the Hungarian algorithm) to directly map predicted triplets to ground truth. To prevent penalizing good relationship predictions due to minor localization errors, the authors integrate an IoU-based assignment strategy into the loss function.
The end-to-end architecture of RelTR, highlighting the Triplet Decoder with subject and object branches.

Datasets

The model was evaluated on three widely accepted SGG benchmarks:

  1. Visual Genome (VG): The standard benchmark containing 108k images with 150 entity categories and 50 predicate categories.
  2. Open Images V6: A large-scale dataset consisting of 126k training images, featuring 288 entity categories and 30 predicate categories.
  3. Visual Relationship Detection (VRD): A smaller dataset used to validate the model's performance under data-constrained settings.

No new benchmarks were introduced in this paper.

Key Insights and Ideas

  • Sparse is Better: Instead of densely evaluating all $O(n^2)$ pairs, learned queries naturally force the model to focus only on noteworthy relationships, leading to a much cleaner, sparse scene graph.
  • Visuals Over Priors: RelTR relies solely on visual appearance rather than language or statistical priors. This significantly reduces common dataset biases, leading to more diverse and context-aware predicate predictions.
  • Coupled Queries Capture Context: Treating subject and object queries as a linked pair within the Transformer decoder allows the model to capture the mutual dependencies inherent in visual relationships, avoiding the need for separate post-hoc graph assembly modules.

Key Results

  • Speed and Efficiency: RelTR is highly lightweight, containing only 63.7M parameters. It achieves an inference speed of 16.6 FPS on a single RTX 2080Ti—making it roughly 7x faster than competitive two-stage models like BGNN.
  • State-of-the-Art One-Stage Performance: On the Visual Genome Scene Graph Detection (SGDET) task, RelTR achieves a Recall@50 (R@50) of 27.5 and a mean Recall@50 (mR@50) of 10.8, outperforming existing one-stage methods like FCSGG and SGTR.
  • Open Images V6 Success: RelTR demonstrates superior weighted mean average precision for relationships (wmAP_rel) and phrases (wmAP_phr) compared to BGNN, proving its scalability to complex, large-scale data.

Limitations and Future Work

  • Self-Referential Triplets: The raw model occasionally predicts triplets where the subject and object are the same entity (e.g., building-near-building). The authors currently handle this via a heuristic post-processing step to filter them out.
  • Long-Tail Predicates: Because it relies purely on visual appearance without semantic knowledge graphs, RelTR struggles with extremely rare (tail) predicates compared to prior-heavy models. While integrating long-tail techniques like logit adjustment helps, closing this gap remains an open area for future work.
Examples of ambiguous self-referential triplets removed during post-processing.

Summary updated

BibTeX
@article{cong2023reltr,
  author = {Yuren Cong and Michael Ying Yang and Bodo Rosenhahn},
  title = {{RelTR: Relation Transformer for Scene Graph Generation}},
  journal = {IEEE Trans. Pattern Anal. Mach. Intell.},
  year = {2023},
  doi = {10.1109/tpami.2023.3268066},
}
Figure