Abstract
The visual relationship recognition (VRR) task aims at understanding the pairwise visual relationships between interacting objects in an image. These relationships typically have a long-tail distribution due to their compositional nature. This paper shows that modeling an effective message-passing flow through an attention mechanism can be critical to tackling the compositionality and long-tail challenges in VRR. The method, called RelTransformer, represents each image as a fully-connected scene graph and restructures the whole scene into the relation-triplet and global-scene contexts. It directly passes the message from each element in the relation-triplet and global-scene contexts to the target relation via self-attention. We also design a learnable memory to augment the long-tail relation representation learning. Our model outperforms the best-performing models on two large-scale long-tail VRR benchmarks, VG8K-LT (+2.0% overall acc) and GQA-LT (+26.0% overall acc), and achieves strong results on the VG200 relation detection task.
Introduction
Visual Relationship Recognition (VRR) involves identifying triplets of <subject, predicate, object> within an image, such as <player, holding, bat>. While foundational for scene understanding, VRR faces two major hurdles:
- The Long-Tail Challenge: In real-world data, a few relationships (e.g., "on", "near") are extremely common, while the vast majority (e.g., "sniffing", "parked on") are rare. Standard models often sacrifice accuracy on these "tail" classes to maximize performance on the "head."
- Contextual Bottlenecks: Traditional methods using Graph Neural Networks (GNNs) or LSTMs often rely on local message passing. However, distant objects frequently provide vital semantic cues. For example, the presence of an "umpire" in the background significantly increases the probability that a "player" is "holding" a "bat."
RelTransformer addresses these issues by treating the scene as a fully connected graph, allowing every element to interact via attention mechanisms.
The RelTransformer Architecture
RelTransformer moves away from rigid, local graph structures toward a more flexible Transformer-based approach. The architecture consists of several key components designed to capture both global context and rare relationship features.
Global-Context Encoder
This multi-layer Transformer processes all detected triplets in a scene simultaneously. By utilizing self-attention, it avoids spatial constraints, enabling the model to aggregate features from distant but semantically relevant objects across the entire image.
Relational Encoder with Memory Augmentation
This module focuses on the target relationship. It incorporates a learnable memory bank—a set of persistent vectors shared across the dataset. This memory acts as a global knowledge base, helping the model "recall" features of rare relationships even when they appear infrequently in a specific training batch, effectively stabilizing learning for the tail of the distribution.
Meshed Attention Fusion
Instead of relying solely on the final layer's output, RelTransformer uses a "meshed" connection to aggregate features from all layers of the global encoder. This ensures the model captures a hierarchy of information, from fine-grained local details to broad global context.
Experimental Results
The model was evaluated on three major benchmarks: VG8K-LT (2,000 relation types), GQA-LT (300 types), and VG200 (50 types). RelTransformer achieved state-of-the-art (SOTA) results, with the most significant gains observed in long-tail scenarios.
- GQA-LT: Achieved a massive +26.0% improvement in overall accuracy compared to previous benchmarks.
- VG8K-LT: Improved overall accuracy by +2.0%, with notable gains in the "medium" and "few" shot categories (+3.1 and +2.4 respectively).
- VG200: Achieved SOTA results on the Mean Recall metric, specifically outperforming others by 4.3% on mR@20, demonstrating robustness even on more balanced datasets.
Qualitative analysis shows that RelTransformer moves beyond trivial predictions. While baseline models might predict generic predicates like "behind," RelTransformer is more likely to identify specific, descriptive interactions such as "sniffing" or "eating from."
Conclusion
RelTransformer demonstrates that modeling non-local message passing and utilizing learnable memory are effective strategies for overcoming the long-tail distribution in visual relationship recognition. By treating the scene as a fully connected graph, the model successfully captures the complex, distant semantic cues necessary for deep scene understanding. Future work may involve integrating linguistic priors or exploring end-to-end architectures to further mitigate the impact of object detection errors.
Summary updated