Abstract
Scene graph generation is an important task in computer vision aimed at improving the semantic understanding of the visual world. In this task, the model needs to detect objects and predict visual relationships between them. Most of the existing models predict relationships in parallel assuming their independence. While there are different ways to capture these dependencies, we explore a conditional approach motivated by the sequence-to-sequence (Seq2Seq) formalism. Different from the previous research, our proposed model predicts visual relationships one at a time in an autoregressive manner by explicitly conditioning on the already predicted relationships. Drawing from translation models in NLP, we propose an encoder-decoder model built using Transformers where the encoder captures global context and long range interactions. The decoder then makes sequential predictions by conditioning on the scene graph constructed so far. In addition, we introduce a novel reinforcement learning-based training strategy tailored to Seq2Seq scene graph generation. By using a self-critical policy gradient training approach with Monte Carlo search we directly optimize for the (mean) recall metrics and bridge the gap between training and evaluation. Experimental results on two public benchmark datasets demonstrate that our Seq2Seq learning approach achieves strong empirical performance, outperforming previous state-of-the-art, while remaining efficient in terms of training and inference time. Full code for this work is available here: https://github.com/layer6ai-labs/SGG-Seq2Seq.
Introduction
In computer vision, Scene Graph Generation (SGG) involves identifying objects in an image and the relationships between them (e.g., "man riding surfboard"). Most existing models predict these relationships in parallel, essentially assuming that each relationship is independent of the others. However, in the real world, relationships are highly correlated. If you know a man is "wearing" a wetsuit and is "on" a beach, the likelihood that he is "holding" a surfboard—rather than just being "near" it—increases significantly. Failing to capture these dependencies leads to ambiguous or biased predictions. Furthermore, standard models are trained using cross-entropy loss, which doesn't directly optimize for the metrics researchers actually care about, such as Recall and mean Recall (mRecall).
Methodology
The authors propose a Seq2Seq Transformer architecture to inject context into the prediction process:
- Encoder: A standard Transformer encoder takes object features (from an off-the-shelf detector like Faster R-CNN) and produces contextualized embeddings that capture the global scene.
- Autoregressive Decoder: Unlike parallel models, this decoder predicts triplets (subject, predicate, object) one at a time. At each step, it "looks back" at the relationships it has already predicted to inform the next one.
- Reinforcement Learning (RL) Training: To bridge the gap between training and evaluation, the authors use a self-critical policy gradient approach. They use Monte Carlo search to estimate the future value of a specific prediction, allowing the model to directly optimize for Recall and mRecall—metrics that are usually non-differentiable.
- Block Decoding: To maintain inference speed, they implement "block decoding," where the model can predict multiple high-confidence triplets simultaneously at each step rather than just one.
Key Insights and Ideas
The core innovation is the quantitative proof that conditioning on previous triplets significantly boosts accuracy. By moving away from parallel prediction, the model can resolve ambiguities. For example, it can distinguish between "riding" and "near" by recognizing easier-to-identify relationships first (like "wearing a helmet").
Using RL to optimize for mRecall helps the model perform better on "long-tail" relationships—those rare predicates that standard models often ignore in favor of more common ones like "on" or "near."
Experimental Results
The Seq2Seq approach achieved state-of-the-art results across several tasks:
- Visual Genome (VG): On the Scene Graph Detection (SGDET) task, the model improved the state-of-the-art mRecall@100 by a significant margin (from roughly 9.9 to 12.1).
- Visual Relationship Detection (VRD): The model set new benchmarks for both Relationship Detection and Phrase Detection.
- Efficiency: Despite the sequential nature of the decoder, the model remains highly competitive in terms of inference time, especially when using block decoding to predict multiple triplets at once.
Qualitative examples show the model "correcting" its beliefs. An initial high-probability guess of "man on surfboard" shifts to the more accurate "man holding surfboard" once the model "sees" the man is wearing a wetsuit or is on the beach.
Conclusion
While the model handles dependencies well, the long-tail distribution of relationships remains a challenge for the field. While mRecall optimization helps, very rare relationships are still difficult to capture. Future work could involve exploring different "canonical orders" for predicting triplets or applying this sequential logic to even more complex tasks like video scene graph generation, where temporal context adds another layer of difficulty.
Summary updated