LayoutGMN: Neural Graph Matching for Structural Layout Similarity

Akshay Gadi Patil, Manyi Li, Matthew Fisher, Manolis Savva, Hao Zhang

Abstract

LayoutGMN is a deep learning framework designed to measure structural similarity between 2D layouts, such as floorplans or user interface (UI) designs. By representing layouts as graphs and employing an attention-based Graph Matching Network (GMN), the model identifies correspondences across designs. This approach moves beyond traditional pixel-based metrics like Intersection-over-Union (IoU), aligning more closely with human intuition regarding structural logic and design intent.

Introduction

Comparing 2D layouts effectively requires an understanding of spatial relationships rather than just pixel-level alignment. Standard metrics like IoU are sensitive to minor coordinate shifts that do not fundamentally alter a design's structure. For instance, moving a room slightly in a floorplan might drastically reduce its IoU score despite the layout remaining functionally identical. Existing Graph Neural Networks (GNNs) often process layouts in isolation, failing to capture the comparative nuances between two designs. LayoutGMN addresses this lack of structural awareness by shifting the problem to neural graph matching.

Methods

LayoutGMN transforms layouts into directed, fully connected graphs where nodes represent semantic elements (e.g., "bedroom", "button") with geometric attributes, and edges encode spatial relationships.

The LayoutGMN architecture featuring cross-graph interaction through attention mechanisms to compute joint embeddings.

The core of the framework is a Graph Matching Network (GMN). Unlike standard GNNs, the GMN incorporates a cross-graph attention mechanism. During message passing, each node "listens" to nodes in the paired graph, allowing the model to calculate similarity scores between specific elements across layouts. The model is trained using a triplet loss on an anchor, a positive, and a negative layout. To overcome the scarcity of human-labeled data, the authors use IoU scores as weak labels for initial training, leveraging the model's structural bias to eventually surpass the teacher metric's performance.

Datasets and Evaluation

The model was evaluated on two large-scale datasets:

  • RICO: Approximately 66,000 mobile UI designs characterized by numerous small, scattered elements.
  • RPLAN: Approximately 77,000 residential floorplans featuring tightly packed, larger subdivisions.

Results

LayoutGMN demonstrates significant improvements over baseline metrics in both human alignment and retrieval stability.

Qualitative retrieval results comparing LayoutGMN against IoU and GCN-CNN baselines. LayoutGMN consistently retrieves designs with more similar structural logic.

Key findings include:

  • Structural Robustness: LayoutGMN ignores pixel-level noise that often misleads IoU, focusing instead on the global context provided by its fully connected graph structure.
  • Human Alignment: Crowd-sourced studies indicated that LayoutGMN's retrieval results are perceived as more structurally relevant than those of state-of-the-art GCN-CNN hybrids.
  • Efficiency: The model is highly performant, requiring only 33ms to compare a layout pair on a standard CPU.
  • Label Transfer: The attention weights generated during matching can be used to transfer semantic labels from a known layout to an unlabeled, structurally similar one.

Conclusion and Future Work

LayoutGMN successfully captures the structural essence of a design through neural graph matching. Future research directions include reducing the dependency on IoU for initial supervision through self-supervised learning, incorporating hierarchical graph structures to represent nested UI elements, and optimizing indexing for large-scale database queries.

Summary updated

BibTeX
@inproceedings{patil2021layoutgmn,
  author = {Akshay Gadi Patil and Manyi Li and Matthew Fisher and Manolis Savva and Hao Zhang},
  title = {{LayoutGMN: Neural Graph Matching for Structural Layout Similarity}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2021},
  url = {https://openreview.net/forum?id=iCPa0u3C_F},
}
Figure