Psychologically-inspired, unsupervised inference of perceptual groups of GUI widgets from GUI images

Mulong Xie, Zhenchang Xing, Sidong Feng, Xiwei Xu, Liming Zhu, Chunyang Chen

Abstract

Modern user interface (UI) understanding requires more than just identifying individual widgets; it necessitates the recognition of higher-order perceptual groups, such as lists, cards, and navigation bars. Traditional approaches often rely on inconsistent underlying code (view hierarchies) or data-hungry supervised models. This paper presents a novel, unsupervised pipeline that leverages classic Gestalt principles of psychology to infer perceptual groups directly from GUI images. Our method significantly outperforms state-of-the-art heuristic baselines, achieving an F1-score of 0.593 on real-world Android screenshots without requiring training data or GPU acceleration.

Introduction

When users interact with a mobile application, they perceive the interface as a structured hierarchy of functional blocks rather than a flat collection of buttons and text labels. This "perceptual grouping" is fundamental to human cognition, allowing us to quickly identify a "product card" or a "settings menu." For automated systems—such as UI-to-code generators, accessibility screen readers, or robotic process automation—replicating this human-centric understanding is critical.

However, two primary challenges hinder current progress. First, the "implementation vs. perception" gap: the internal view hierarchy defined by developers often fails to reflect the visual layout. A single visual group might be fragmented across multiple containers, or unrelated elements might be grouped together for coding convenience. Second, supervised machine learning models require vast amounts of accurately labeled data, which is difficult to obtain given the inherent noise in existing datasets.

Methodology

To address these challenges, we propose a multi-stage pipeline inspired by Gestalt psychology, which posits that the human brain organizes visual information based on specific rules.

1. Enhanced Widget Detection

The process begins with identifying individual widgets using an improved version of UIED. We integrated Google’s OCR for superior text recognition and implemented "container-aware" logic. This ensures that widgets nested within boxes are correctly identified rather than being merged into a single entity.

2. Connectedness (Container Recognition)

Following the principle of common region, the system identifies wireframes or boundaries—such as the borders of a card—that physically enclose multiple widgets. These boundaries serve as strong indicators of a functional group.

3. Similarity (Widget Clustering)

Using the DBSCAN algorithm, the system clusters widgets based on shared visual attributes, including size, area, and alignment. For example, a vertical column of identical icons is grouped based on their visual consistency.

4. Proximity (Recursive Group Pairing)

The system then applies the principle of proximity to pair clusters that are spatially close and follow a consistent pattern. This allows the model to combine a cluster of images with a cluster of text labels to form a cohesive "list item."

5. Continuity (Error Correction)

A unique "self-healing" mechanism utilizes the principle of continuity. If a group exhibits a clear pattern but one element is missing (due to detection failure), the system uses the group's symmetry to re-scan the specific area with higher sensitivity, "finding" the missing widget based on its expected context.

Experimental Evaluation

We evaluated our approach using two distinct datasets:

  • Android App Dataset: 1,091 screenshots from 772 real-world apps, derived from a cleaned subset of the Rico dataset.
  • UI Design Prototypes: 20 high-fidelity Figma mockups to test the system's performance on professional layouts before implementation.

To ensure accuracy, we established a manual ground truth based on human perception rather than relying on potentially flawed code metadata.

Results and Discussion

Our method was compared against "Screen Recognition," a state-of-the-art heuristic baseline. The results demonstrate a substantial improvement in performance:

  • Real-World Accuracy: Our method achieved an F1-score of 0.593, compared to the baseline's 0.092.
  • Ideal Conditions: When provided with "perfect" initial widget data, our grouping logic reached an F1-score of 0.672, while the baseline only managed 0.123.
  • Efficiency: The system is highly efficient, processing a GUI image in an average of 1.7 seconds on a standard consumer laptop without the need for a GPU.

The success of this approach highlights the power of "Psychology over Big Data." By utilizing domain-independent psychological rules, the model generalizes across different design trends without the need for extensive retraining. Furthermore, the "Continuity" mechanism proves that the global context of a group can effectively inform the detection of its individual parts.

Limitations and Future Work

While effective, the system faces challenges with occlusion, such as floating action buttons or pop-up modals, which can disrupt the proximity and connectedness rules. Additionally, while the system identifies that a group exists, it does not yet assign semantic meaning (e.g., identifying a group specifically as a "Bottom Navigation Bar"). Future research will focus on combining these visual patterns with natural language processing to achieve automated semantic labeling.

Summary updated

BibTeX
@inproceedings{xie2022psychologically,
  author = {Mulong Xie and Zhenchang Xing and Sidong Feng and Xiwei Xu and Liming Zhu and Chunyang Chen},
  title = {{Psychologically-inspired, unsupervised inference of perceptual groups of GUI widgets from GUI images}},
  booktitle = {ESEC/SIGSOFT FSE},
  year = {2022},
  doi = {10.1145/3540250.3549138},
}
Figure