Graph Reasoning Transformer for Image Parsing

Dong Zhang, Jinhui Tang, Kwang-Ting Cheng

Abstract

Standard Vision Transformers (ViTs) rely on all-to-all attention mechanisms that often result in redundant computations and unoriented interactions between image patches. This paper introduces the Graph Reasoning Transformer (GReaT), which projects image patches into a compact graph space to perform global reasoning on a small set of learned visual centers. By bottlenecking interactions through these centers, GReaT eliminates noise and improves efficiency. Experimental results on Cityscapes and ADE20K demonstrate that GReaT consistently outperforms standard transformer baselines in semantic segmentation tasks.

Introduction

Image parsing, or semantic segmentation, is a fundamental computer vision task that requires a model to assign a semantic label to every pixel in an image. Success in this domain depends on the model's ability to integrate local textures with global context. While Vision Transformers (ViTs) have become the de facto standard for capturing long-range dependencies via Multi-Head Attention (MHA), they suffer from two primary inefficiencies: redundant interactions within uniform regions and unoriented interactions where all patches are initially treated with equal importance.

To address these issues, we present the Graph Reasoning Transformer (GReaT). Instead of allowing every patch to interact with every other patch, GReaT leverages a Graph Reasoning Block (GReaB) to aggregate patch features into a set of implicit visual centers, perform reasoning in this reduced graph space, and map the refined information back to the original image patches.

Methodology: The Graph Reasoning Block (GReaB)

The core of the GReaT architecture is the Graph Reasoning Block, which replaces the standard self-attention layer. The GReaB operates through a three-step process:

1. Patch Projection

Given $N$ image patches, the model projects them into a graph space consisting of $M$ nodes, where $M$ is significantly smaller than $N$ (typically $M=16$). These nodes represent "implicit visual centers"—learned aggregations of similar visual features across the entire image. This step effectively filters out redundant information from uniform areas.

2. Information Diffusion

Global reasoning is performed on these $M$ nodes using a single-layer Graph Convolutional Network (GCN). The nodes exchange information based on a learned adjacency matrix that represents relational weights between different semantic regions. This allows the model to capture high-level relationships, such as the typical proximity of "cars" to "roads."

3. Node Mapping

After the graph-based reasoning, the processed features are mapped back from the $M$ nodes to the original $N$ patches. This is achieved using the transpose of the initial projection weights, ensuring that the global context is correctly distributed back to the local patch representations.

Efficiency and Complexity

A significant advantage of GReaT is its computational efficiency. Standard self-attention mechanisms have a space complexity of $O(H^2W^2)$, which scales poorly with increasing image resolution. By bottlenecking the interaction through a fixed number of graph nodes, GReaT reduces this complexity to $O(M^2)$. This makes the architecture highly scalable for high-resolution dense prediction tasks without sacrificing the ability to model long-range dependencies.

Experimental Results

The GReaT framework was evaluated by integrating it into several prominent transformer backbones, including SETR, SegFormer, and Swin Transformer.

Cityscapes

On the Cityscapes dataset, which features high-resolution urban street scenes, GReaT-SegFormer-B5 achieved a mean Intersection over Union (mIoU) of 84.21%, representing a 0.7% improvement over the baseline. Similarly, GReaT-Swin-B reached 81.1% mIoU, compared to the baseline's 80.2%.

ADE20K

On the more diverse ADE20K dataset, GReaT-MiT-B5 achieved 52.58% mIoU, outperforming the standard SegFormer-B5 (51.80%). Qualitative analysis indicates that GReaT is particularly effective at maintaining the structural consistency of thin objects and accurately delineating the boundaries of small objects like traffic signs.

Discussion

Ablation studies revealed a "sweet spot" for the number of graph nodes. Interestingly, increasing $M$ beyond 16 led to a decrease in performance. This suggests that a very small number of nodes is sufficient to capture the essential semantic relationships of a scene, and that additional nodes may re-introduce the noise and redundancy that the graph projection was designed to eliminate.

While GReaT introduces a slight parameter overhead (approximately 5-11% depending on the backbone), the gains in accuracy and the reduction in attention-related computational complexity provide a favorable trade-off for complex image parsing tasks.

Conclusion

The Graph Reasoning Transformer offers a more purposeful and efficient approach to global context modeling in image parsing. By shifting from patch-to-patch attention to reasoning over learned visual centers, GReaT achieves state-of-the-art results while maintaining scalability. Future work may explore dynamic graph structures that adapt to scene complexity and the application of graph reasoning to other vision tasks such as object detection and image generation.

Summary updated

BibTeX
@inproceedings{zhang2022graph,
  author = {Dong Zhang and Jinhui Tang and Kwang-Ting Cheng},
  title = {{Graph Reasoning Transformer for Image Parsing}},
  booktitle = {ACM Multimedia},
  year = {2022},
  doi = {10.1145/3503161.3547858},
}
Figure