Source-linked AI summary
RelTR: Relation Transformer for Scene Graph Generation
Yuren Cong, Michael Ying Yang, Bodo Rosenhahn
TL;DR
Scene graph generation must identify noteworthy relationships without exhaustively labeling all possible entity pairs, while existing two-stage methods use many parameters. RelTR addresses this with an end-to-end Transformer that directly predicts fixed-size triplet sets from visual appearance using coupled queries and set-based matching. The authors report state-of-the-art performance with faster inference across multiple datasets, while noting a same-entity subject-object limitation handled in post-processing.
Problem
Existing two-stage SGG methods generate entity proposals and classify dense relationships between them, creating a parameter-heavy alternative to direct relationship prediction.
Method
RelTR is an end-to-end one-stage encoder-decoder that directly predicts fixed-size subject-predicate-object triplets from visual appearance using coupled queries, attention mechanisms, and IoU-based set matching.
Results
RelTR achieves state-of-the-art performance on three datasets with balanced evaluation metrics, efficient rapid inference, and fewer parameters than previous two-stage models.
Takeaways & Limitations
RelTR demonstrates that sparse triplet prediction can replace exhaustive predicate labeling while retaining strong scene graph generation performance and fast inference.
Takeaways & Limitations
RelTR can output triplets whose subject and object are the same entity with an ambiguous predicate, so post-processing removes such triplets.
Abstract
from arXiv · showhide
Different objects in the same scene are more or less related to each other, but only a limited number of these relationships are noteworthy. Inspired by DETR, which excels in object detection, we view scene graph generation as a set prediction problem and propose an end-to-end scene graph generation model RelTR which has an encoder-decoder architecture. The encoder reasons about the visual feature context while the decoder infers a fixed-size set of triplets subject-predicate-object using different types of attention mechanisms with coupled subject and object queries. We design a set prediction loss performing the matching between the ground truth and predicted triplets for the end-to-end training. In contrast to most existing scene graph generation methods, RelTR is a one-stage method that predicts a set of relationships directly only using visual appearance without combining entities and labeling all possible predicates. Extensive experiments on the Visual Genome and Open Images V6 datasets demonstrate the superior performance and fast inference of our model.
1 INTRODUCTION
RelTR addresses limitations of parameter-heavy two-stage scene graph generation by directly predicting sparse relationship triplets from visual appearance. Its end-to-end design uses learned queries, set-based matching, and attention mechanisms, with experiments reporting state-of-the-art performance, faster inference, and fewer parameters.
- Motivation: Two-stage SGG models first generate entity proposals and then classify relationships between them, requiring many trained parameters.With n object proposals, relationship inference considers dense subject-object relationships.
- Motivation: DETR-style set prediction motivates learning a fixed number of subject-predicate-object triplets through bipartite matching.The paper identifies direct assignment of ground-truth information to relationship predictions as a challenge.
- RelTR: RelTR is an end-to-end one-stage framework that concurrently predicts subjects, objects, and predicates using visual appearance alone.It is evaluated on Visual Genome and Open Images V6.
- RelTR: RelTR generates sparse scene graphs by decoding visual appearance with learned subject and object queries instead of classifying all dense entity relationships.This design avoids labeling predicates between every possible subject-object pair.
- Results: RelTR is reported to use fewer parameters and achieve faster inference while attaining state-of-the-art SGG performance.The authors also report comprehensive component and learned-query analyses.
- RelTR: RelTR uses a set prediction loss with IoU-based assignment and decoupled entity attention to match triplets and improve subject-object localization and classification.The entity decoder’s detection results inform the triplet decoder.
2 RELATED WORK
Related work places RelTR within scene graph generation, Transformer-based set prediction, and emerging one-stage approaches. The paper distinguishes its direct triplet prediction from methods that assemble graphs from separately predicted entities or classify dense proposal pairs.
- Scene Graph Generation: Scene graph generation detects relationships between objects and supports image retrieval, captioning, VQA, and image synthesis.Earlier work often focused on specific relationship types, while later methods address broader visual relationships and class imbalance.
- Scene Graph Generation: Most established SGG systems are two-stage models that use object detectors and relationship reasoning over detected entities.Related methods incorporate global or local context through residual networks, recurrent networks, or stacked LSTMs.
- One-Stage SGG: One-stage SGG methods are simpler, faster, and easier to train, but earlier FCSGG results showed a substantial performance gap from two-stage methods.RelTR is introduced to address this gap with a Transformer-based design using visual appearance.
- One-Stage SGG: RelTR directly predicts triplet proposals, whereas SGTR independently predicts entity and predicate proposals before graph assembly.The paper reports higher recall scores for RelTR than SGTR.
- Transformer and Set Prediction: Transformer set prediction uses object queries to predict a fixed-size proposal set and bipartite matching for end-to-end training.This formulation has also been applied to instance segmentation, image captioning, and multiple-object tracking.
- Transformer and Set Prediction: RelTR uses coupled subject and object queries because direct triplet queries may yield low subject-object localization and classification accuracy on large-scale datasets.The coupled design targets general scene relationships rather than only human-object interactions.
3 METHOD
RelTR formulates scene graph generation as direct prediction of a fixed-size set of subject-predicate-object triplets. This one-stage formulation predicts entity vertices and relationship edges together rather than first labeling predicates between detected entity pairs.
- 3 METHOD: RelTR directly predicts a fixed-size set of <V_sub-E_prd-V_obj> triplets for scene graph generation.The model differs from approaches that detect entity vertices first and label predicates between them.
3.1 Preliminaries
The preliminaries describe Transformer attention and DETR’s query-based set prediction framework. DETR encodes image context, transforms learned entity queries into representations, and trains through assignment between predictions and padded ground-truth entities.
- 3.1.1 Preliminaries: Single-head attention takes queries, keys, and values as input, while its output is computed from their attention function.The complete Transformer attention block adds multi-head attention, normalization, and a residual connection.
- 3.1.1 Preliminaries: The attention scaling factor uses d_k, the dimension of the keys.This dimension appears in the denominator of the attention computation.
- 3.1.2 DETR: DETR’s encoder converts CNN features and positional encodings into visual context, while its decoder transforms learned entity queries into entity representations.Entity queries interact to capture entity context and extract visual features.
- 3.1.2 DETR: DETR trains with a set prediction loss that assigns ground-truth entities to predictions after padding the target set with background entries.A cost matrix and the Hungarian algorithm determine the prediction-ground-truth assignment.
- 3.1.2 DETR: The entity loss combines cross-entropy classification with box regression based on L1 and generalized IoU losses for non-background predictions.The classification term is applied to label prediction, while the box term supervises localization.
3.2 RelTR Model
RelTR uses an encoder-decoder architecture to directly predict a fixed number of subject-predicate-object triplets from visual features. Its triplet decoder combines coupled query reasoning with decoupled visual and entity attention before predicting entity boxes, classes, and predicates.
- Architecture: RelTR directly predicts N_t triplets without inferring predicates between all entity pairs.The model contains a feature encoder, entity decoder, and triplet decoder with subject and object branches.
- Coupled self-attention: Subject and object queries are learned separately, while coupled self-attention models dependencies among triplets, subjects, and objects.The resulting query representations remain available to their respective subject and object branches.
- Decoupled visual attention: Decoupled visual attention independently updates subject and object representations using the visual feature context and positional encodings.The resulting attention heat maps are also used as spatial features for predicate classification.
- Decoupled entity attention: Decoupled entity attention bridges entity and triplet detection by supplying localization and classification information from entity representations.The entity representations are intended to improve subject and object localization and classification.
- Final inference: The final decoder representations predict subject and object classes and boxes, while concatenated attention maps and representations produce predicate probabilities.Independent feed-forward networks regress normalized box coordinates, and an MLP predicts predicates from entity and spatial features.
3.3 Set Prediction Loss for Triplet Detection
RelTR trains triplet detection as set prediction by matching predicted and ground-truth triplets with a composite cost and Hungarian bipartite matching. An IoU-based assignment strategy prevents incorrect background supervision when a prediction already localizes a ground-truth entity sufficiently well.
- Triplet matching: RelTR extends entity set-prediction loss to triplet detection and represents each prediction with subject, predicate, and object outputs.Subject and object include class and box predictions, while predicates include class predictions.
- Triplet matching: Each predicted triplet is matched using subject, object, and predicate costs, with Hungarian bipartite matching assigning ground-truth triplets.Subject and object costs use class probabilities and boxes; predicate cost uses predicate class probability.
- Triplet matching: When predictions exceed ground-truth triplets, the ground-truth set is padded with Φ representing background-no relation.The padding enables fixed-size triplet prediction and matching.
- Matching cost: The box cost combines 5L1 and 2LGIoU, while the matching cost includes separate subject, object, and predicate terms.The class cost is combined with box cost for entities, whereas predicates use only their class cost.
- IoU-based assignment: IoU-based assignment suppresses subject or object loss when its predicted label is correct and box IoU reaches threshold T.The indicator Θ is 0 in that case and 1 otherwise; total loss combines entity and triplet losses.
3.4 Post-processing
RelTR removes post-processed triplets whose subject and object refer to the same entity, because their predicates are usually ambiguous.
- Post-processing: Unlike two-stage methods, RelTR predicts subjects and objects simultaneously as a fixed number of triplets, without enforcing distinct subject-object entities during prediction.This can produce triplets whose subject and object are the same entity.
- Post-processing: Triplets with identical subject and object entities are removed when labels and bounding-box IoU indicate entity identity.The paper describes these cases as having ambiguous predicates.
4 EXPERIMENTS
RelTR is evaluated on Visual Genome, Open Images V6, and VRD using recall, mean recall, zero-shot recall, average precision, parameter count, and inference speed. Across datasets, it provides competitive or superior results while retaining one-stage efficiency and compatibility with long-tailed techniques.
- Datasets and Metrics: Visual Genome contains 108k images, 150 entity categories, and 50 predicate categories, with PredCLS, SGCLS, and SGDET as standard evaluation settings.
- Visual Genome: RelTR achieves R@50 = 27.5 and mR@50 = 10.8 on Visual Genome SGDET, respectively 5.1 and 6.2 points above one-stage FCSGG.
- Visual Genome: RelTR achieves R@50 = 64.2 and mR@50 = 21.2 on PredCLS, and R@50 = 36.6 and mR@50 = 11.4 on SGCLS.
- Visual Genome: RelTR has the best mR@K and zsR@k among general Visual Genome models and remains balanced across R@K, mR@K, and zsR@k.
- Open Images V6: On Open Images V6, RelTR’s weighted score is 1.02 points above VCTree, with 16.3 FPS inference speed and higher wmAP_rel than BGNN and wmAP_phr than VCTree.
- VRD: RelTR outperforms other two-stage methods on both relationship detection and phrase detection on VRD after fine-tuning from Visual Genome pretrained weights.
- Long-tailed Techniques: Logit adjustment raises mR@50 to 14.2 with a minor 1.6-point drop in R@50, while both long-tail techniques improve body- and tail-group inference.
4.4 Ablation Studies
Ablations show that contextual encoding, triplet decoding, coupled self-attention, and assignment matching materially affect RelTR’s performance and efficiency. Long-tailed techniques improve minority-relation performance, with trade-offs in overall recall.
- 4.4.1 Number of Layers: Removing the encoder causes R@50 to drop by 4.2 points, while increasing triplet decoder layers from 3 to 6 substantially improves recall before performance decreases at 9 layers.
- 4.4.2 Module Effectiveness: Disabling the triplet decoder reduces R@50 to 18.3, showing that the simple DETR-based visual baseline is insufficient for relationship prediction.
- 4.4.2 Module Effectiveness: CSA prevents duplicate or semantically invalid triplets caused by independent subject and object queries, while DVA supplies visual information for scene-graph prediction.
- 4.4.2 Module Effectiveness: DEA improves subject and object quality and increases R@50 by 0.6, whereas the mask head provides limited improvement.
- 4.4.3 Assignment Strategy: Deactivating IoU-based assignment matching produces the worst performance, indicating that the matching strategy contributes to set-prediction training.
- 4.4.4 Triplet Number: Increasing coupled query count linearly increases parameters and decreases FPS, while performance changes non-linearly.
4.5 Analysis on Subject and Object Queries
RelTR’s coupled subject-object queries learn differentiated spatial and semantic roles rather than producing identical distributions. Query-specific behavior is examined through predictions across 5000 Visual Genome test images.
- Query Distributions: Predictions from 10 of 200 coupled queries over 5000 Visual Genome test images reveal distinct subject and object spatial and class distributions.
- Query Distributions: The query analysis also examines top-5 predicate distributions, showing that coupled queries learn different patterns of triplet prediction.
4.6 Qualitative Results
Qualitative examples illustrate RelTR’s relationship predictions, attention regions, duplicate outputs, and sensitivity to annotation conventions. Open Images examples are reduced to the most confident triplet because its annotations are sparse.
- Visual Genome: Visual Genome examples display the top-9 relationships, subject and object boxes, attention scores, and generated scene graphs, including duplicate predictions.
- Visual Genome: RelTR predicts the infrequent spatial relation in front of for a car-building pair, but annotation preferences reduce its R@9 to 41.7 despite plausible outputs.
- Visual Genome: In a woman-computer example, 6 of 9 predictions are considered valid although R@9 is 0 because the VG-150 split uses laptop rather than computer.
- Interpretability: Attention visualizations identify regions of interest for predicted relationships, making model behavior easier to interpret.
- Open Images V6: Open Images annotations contain 2.8 triplets per image on average, so qualitative results show only the most confident prediction per image.
5 CONCLUSION
RelTR directly infers a fixed-size set of relationships from visual appearance using coupled subject-object queries and Transformer attention. It achieves state-of-the-art performance with efficient inference, while qualitative examples cover both Visual Genome and Open Images V6.
- RelTR uses a Transformer encoder-decoder with coupled subject and object queries to infer a fixed-size relationship set directly from visual appearance.
- Different attention mechanisms in the triplet decoder support direct inference of subjects, predicates, and objects without labeling every possible subject-object pair.
- An IoU-based assignment strategy optimizes the matching between predicted triplets and ground-truth triplets during training.
- RelTR achieves state-of-the-art performance on three datasets of different scales with balanced performance across evaluation metrics.
- Qualitative results are presented for Visual Genome and Open Images V6, whose annotations differ in triplet density and scene complexity.