Learning to Compose Dynamic Tree Structures for Visual Contexts

Kaihua Tang, Hanwang Zhang, Baoyuan Wu, Wenhan Luo, Wei Liu

Introduction

In computer vision, objects are rarely perceived in isolation; their meaning is deeply intertwined with their visual context. For instance, identifying a "helmet" is significantly easier when it is seen on a "head." Effectively capturing these relationships is crucial for high-level tasks like Scene Graph Generation (SGG) and Visual Question Answering (VQA).

Historically, models have represented context using either Chains (sequences of objects) or Fully-Connected Graphs. While chains are efficient, they are too rigid for complex hierarchies. Conversely, fully-connected graphs often suffer from "message saturation," where the signal is lost in the noise of irrelevant connections. Furthermore, these static structures fail to account for the task-dependent nature of visual context—the way we relate objects should change based on the question being asked.

Comparison of visual context structures: Chains and Fully-Connected Graphs versus the proposed task-dependent Dynamic Tree.

The VCTREE Framework

To address these limitations, this paper introduces VCTREE (Visual Context Tree), a framework that learns to arrange objects into a dynamic, task-specific binary tree. This structure allows the model to distinguish between hierarchical relations (e.g., a part-of relationship) and parallel relations (e.g., objects appearing side-by-side).

The VCTREE pipeline consists of four primary stages:

  1. Feature Extraction: Objects are detected via Faster R-CNN, with visual features extracted through RoIAlign and spatial features derived from bounding box coordinates.
  2. Dynamic Tree Construction: The model computes a score matrix representing the validity of connections between object pairs. Using Prim’s algorithm, it finds a Maximum Spanning Tree, which is then transformed into a Left-Child Right-Sibling (LCRS) binary tree. In this format, left branches typically encode hierarchical dependencies, while right branches encode parallel co-occurrences.
  3. Context Encoding: A Bidirectional TreeLSTM (BiTreeLSTM) processes the resulting tree, facilitating both top-down and bottom-up information flow. This ensures every object representation is enriched by its structural neighbors.
  4. Hybrid Learning: Since tree construction is a discrete operation, the model is trained using a combination of supervised learning and REINFORCE. The reinforcement learning component uses the end-task performance (e.g., VQA accuracy) as a reward signal to optimize the tree structure.
The end-to-end VCTREE pipeline, illustrating feature extraction, tree construction, context encoding, and downstream application in SGG and VQA.

Experimental Evaluation

The authors evaluated VCTREE on two benchmark datasets: Visual Genome (VG) for scene graph generation and VQA 2.0 for question answering.

Scene Graph Generation

VCTREE established a new state-of-the-art on Visual Genome. It demonstrated a significant improvement in Mean Recall, a metric that prioritizes rare but informative predicates. For Predicate Classification, VCTREE achieved a Mean Recall@100 of 19.4%, a 4.1% absolute gain over the previous leading Motifs model. This suggests that the tree structure better captures the nuanced relationships that frequency-based models often miss.

Visual Question Answering

On the VQA 2.0 "Balanced Pairs" subset, VCTREE outperformed both chain and fully-connected graph baselines, reaching 37.2% accuracy. Qualitative analysis showed that the tree structure dynamically adapts to the query; for a question about a "man's head," the model correctly positions the "man" and "helmet" as central nodes in the hierarchy, effectively pruning irrelevant background objects.

Conclusion

VCTREE demonstrates that visual context is not a static property of an image but a dynamic, task-driven structure. By learning to compose hierarchical trees, the model achieves superior performance and improved interpretability across multiple vision-language tasks. Future work may explore "dynamic forests" to represent scenes with multiple independent object clusters and further optimize the computational efficiency of the tree construction process.

Summary updated

BibTeX
@inproceedings{tang2019learning,
  author = {Kaihua Tang and Hanwang Zhang and Baoyuan Wu and Wenhan Luo and Wei Liu},
  title = {{Learning to Compose Dynamic Tree Structures for Visual Contexts}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2019},
  doi = {10.1109/cvpr.2019.00678},
}
Figure