This study uses publicly available datasets and does not involve human or animal subjects.
The proposed automated UI prototyping framework integrates deep learning–based structural understanding, perceptually uniform color modeling, and cognitive design principles to generate coherent and user-centered interface prototypes. The methodology begins with a Faster R-CNN architecture trained on the RICO and ENRICO datasets to detect UI components and extract their hierarchical relationships, enabling accurate interpretation of diverse screen layouts. The detected components are then processed by a color intelligence module, which extracts brand- or image-based color cues, models perceptual similarity using CAM02-UCS, and generates harmonious, contrast-aware, and accessibility-compliant color palettes. Subsequently, cognitive design principles—including Gestalt grouping laws, Fitts’ law, Hick’s law, attention-based spacing, and visual hierarchy constraints—are applied through a cognitive optimization engine to refine spatial organization and component alignment. Finally, a layout reasoning layer integrates structural, perceptual, and cognitive constraints to generate multiscreen consistent UI prototypes that balance usability, aesthetics, and functional clarity. This integrated pipeline ensures perceptual coherence, reduces cognitive load, and adheres to human-centered design principles. The complete workflow of the proposed method is illustrated in Figure 1.

Figure 1. Overall architecture of the proposed automated user interface prototyping framework. The diagram illustrates the complete pipeline, starting from an input UI image. Component detection is performed using Faster R-CNN to identify interface elements. The detected components are then processed using CAM02-UCS-based perceptual modeling for hierarchy and layout extraction. Cognitive optimization is subsequently applied using Gestalt principles, Fitts’ law, Hick’s law, and attention-based adjustments. Arrows indicate the flow of data between modules, resulting in the final UI prototype output. Please click here to view a larger version of this figure.
Overview of the framework
Figure 1 illustrates the end-to-end workflow of the proposed automated UI prototyping framework, which transforms a raw UI screenshot into a cognitively refined prototype. The process begins with the input UI image, which is passed to the component detection module based on Faster R-CNN. This module identifies interface elements such as buttons, icons, text fields, and containers, and outputs their corresponding bounding boxes and class labels. The detected components are then processed in the hierarchy and layout extraction stage. Based on spatial relationships and structural patterns, the system constructs a hierarchical layout tree that reflects how users naturally perceive screen organization. This representation captures visual grouping and structural dependencies among UI elements. The extracted layout is subsequently refined through cognitive optimization by applying human-centered design principles. These include Gestalt grouping for visual clustering, Fitts’ law for optimizing touch-target size and accessibility, Hick’s law for reducing decision complexity, and attention-based spacing for improving visual hierarchy. As a result, the layout becomes more intuitive, readable, and efficient for user interaction. Finally, the optimized layout is combined with perceptual color modeling to generate a coherent UI prototype. The resulting interface is structurally accurate, visually harmonious, and aligned with human usability expectations.
The framework was implemented using PyTorch 2.0 on Ubuntu 22.04. Experiments were conducted on a system equipped with an NVIDIA RTX 4090 GPU (24 GB VRAM). The Faster R-CNN model employed a ResNet-50 backbone pre-trained on the ImageNet dataset. Training was performed using the stochastic gradient descent (SGD) optimizer with a learning rate of 0.001, batch size of 16, and up to 60 epochs. Early stopping was applied to prevent overfitting using a validation set comprising 20% of the data. Although training was performed for up to 60 epochs, convergence was typically achieved earlier through early stopping based on validation loss. Momentum and weight decay were set to 0.9 and 0.0005, respectively. Data augmentation included normalization, random horizontal flipping, and random cropping and resizing.
Dataset preparation
To support the proposed automated UI prototyping framework, three complementary datasets were utilized: ENRICO29, RICO30, and Guo’s UI Color Dataset1. The RICO dataset contains 66,261 Android UI screens collected from 9,700 applications, providing large-scale diversity for component detection and hierarchical layout extraction. ENRICO includes 1,464 high-quality UI screenshots manually categorized into 20 design patterns, enabling improved generalization for structural reasoning and layout consistency modeling. Guo’s UI Color Dataset consists of 128 curated UI images with annotated color themes, which are used for perceptual color modeling and palette evaluation. However, due to its relatively smaller size, this dataset may introduce some variability in layout characteristics. For this study, a combined dataset of 5,128 screens was prepared for training and evaluation. Specifically, approximately 4,000 images from RICO were used to train the Faster R-CNN model for component detection, 1,000 images from ENRICO were used for layout pattern learning and structural consistency modeling, and 128 images from Guo’s dataset were used for color evaluation tasks. All images were normalized to a resolution of 480 × 800 pixels, converted to a uniform sRGB color space, and re-annotated with standardized bounding boxes and hierarchical metadata to ensure compatibility across datasets. An overview of the datasets used in this study is provided in Table 2. The RICO dataset supports large-scale detection of UI components and structural analysis, while ENRICO enhances the model’s ability to recognize layout patterns and enforce cross-screen consistency. Guo’s UI Color Dataset, although smaller in size, plays a critical role in evaluating perceptual color harmony and contrast modeling. Together, these datasets provide a comprehensive and well-balanced foundation for training, validation, and evaluation of the proposed automated UI prototyping framework.
| Dataset | Total Images Available | Images Used in Study | Purpose in Proposed Framework |
| RICO Dataset30 | 66,261 | 4,000 | UI component detection, structural layout extraction |
| ENRICO Dataset29 | 1,464 | 1,000 | Design pattern learning, layout consistency modeling |
| Guo’s UI Color Dataset1 | 128 | 128 | Color theme extraction, perceptual color evaluation |
| Combined Total | 67,853 | 5,128 | Comprehensive dataset for detection, layout, color modeling |
Table 2: Summary of datasets used in the proposed framework. The table presents the datasets utilized for training and evaluation, including the RICO, ENRICO, and Guo’s UI Color Datasets. It reports the total number of images available, the subset used in this study, and the specific role of each dataset in component detection, layout modeling, and perceptual color analysis within the proposed framework.
A stratified sampling strategy was employed to preserve diversity in UI components, layout structures, and color distributions across RICO, ENRICO, and Guo datasets. The dataset was split into training (70%), validation (15%), and testing (15%) subsets using stratified sampling. Images were normalized using mean (0.485, 0.456, and 0.406) and standard deviation (0.229, 0.224, and 0.225). Data augmentation included random horizontal flipping (probability = 0.5) and random cropping (scale range: 0.8–1.0), followed by resizing to 224 × 224 pixels applied during training.
Component annotation and preprocessing
The RICO, ENRICO, and Guo’s UI Color Dataset collectively support the three core functional components of the proposed automated UI prototyping framework: component detection, layout modeling, and perceptual color optimization. The RICO dataset contains a large-scale collection of more than 66,000 mobile UI screens and is primarily used for training the component detection module. Its diversity enables the Faster R-CNN model to learn robust representations of common UI elements such as buttons, images, and text fields across a wide range of applications. This ensures accurate detection and localization of UI components under varying design conditions. The ENRICO dataset provides high-quality, pattern-labeled UI screens for learning structural relationships and layout patterns. It enables the system to understand inter-component relationships, hierarchical organization, and common design templates. This dataset plays a critical role in modeling layout structures and enforcing multiscreen consistency, allowing the framework to generate layouts that align with established design conventions. In contrast, Guo’s UI Color Dataset is specifically used for perceptual and cognitive color modeling. Unlike RICO and ENRICO, which focus on structural aspects, this dataset contains curated UI images with annotated color themes. These annotations are used to train color extraction and harmony evaluation modules. By mapping color relationships into perceptual color spaces such as CAM02-UCS, the framework learns to generate color palettes that balance contrast, accessibility, and aesthetic coherence. Together, these datasets form an integrated pipeline: RICO supports component detection, ENRICO enables layout pattern understanding and structural consistency, and Guo’s dataset facilitates perceptual color optimization. This integration ensures that the generated UI prototypes are structurally accurate, visually harmonious, and cognitively optimized.
Normalization was performed using a mean of [0.485, 0.456, 0.406] and a standard deviation of [0.229, 0.224, 0.225]. Data augmentation techniques, including random cropping, horizontal flipping, and rotation, were applied to improve model generalization. In addition, pixel values were scaled to the range [0, 1], and all images were resized to a resolution of 480 × 800 pixels to ensure consistency across datasets. Images resized to 224 × 224 pixels are used for augmentation during training, while the original resolution of 480 × 800 pixels is preserved for layout analysis. Bounding boxes were adjusted to filter out irrelevant annotations using predefined thresholds. To achieve uniformity across datasets, all UI elements were manually annotated using the LabelImg annotation tool. A predefined schema was established prior to annotation to classify UI elements into categories such as button, text, image, icon, and container. For bounding box representation, a uniform coordinate system was applied, and hierarchical information was constructed based on spatial relationships between elements and their parent–child associations within the layout tree. In addition, guidelines were established to ensure consistent annotation of elements, proper handling of overlapping components, and enforcement of minimum size thresholds across the RICO, ENRICO, and Guo datasets.
Detailed mathematical formulations for component detection training and layout pattern extraction are provided in Supplementary File 1.
The Faster R-CNN model was trained using SGD with a momentum of 0.9 and a weight decay of 0.0005. The initial learning rate was set to 0.001 and adjusted using a step decay policy based on validation performance. Training was performed for up to 60 epochs with a batch size of 16. Early stopping was applied to prevent overfitting, using a validation set comprising 20% of the training data.
The mapping function f(.) takes detected UI elements as input and produces a hierarchical layout representation as output. It computes adjacency relationships between UI elements based on spatial distance and alignment criteria, and constructs an adjacency matrix to represent these relationships. A clustering algorithm, such as DBSCAN, is then applied to group related components. Finally, clustered elements are organized into hierarchical structures based on parent–child relationships, forming a structured layout representation.
Detailed formulations for color harmony modeling and the unified optimization objective are provided in Supplementary File 1.
This objective function mathematically formalizes the integration of structural detection, layout reasoning, and perceptual color modeling, ensuring that all components of the framework contribute jointly to generating coherent and user-centered UI prototypes. Optimization is performed in a modular manner for each component of the framework. SGD is used for training the component detection module, while the Adam optimizer is used during joint optimization of the unified objective. The combined objective is used to guide overall system performance. For joint optimization stages, the objective function is minimized using the Adam optimizer with a learning rate of 0.001 and a batch size of 16. Training is performed for up to 60 epochs, with early stopping applied when the validation loss change is less than 10−4 for five consecutive epochs.
Component detection using Faster R-CNN
The proposed framework employs Faster R-CNN for automatic detection of UI components, including buttons, icons, text fields, images, and containers. Faster R-CNN is well suited for this task because it combines high object detection accuracy with efficient region proposal generation, which is essential for handling complex UI layouts containing densely packed elements. The model utilizes a ResNet-50 backbone pre-trained on the ImageNet dataset to extract convolutional feature maps from each UI screen. During training, the early layers were frozen to retain general visual features, while the higher layers (conv4_x and conv5_x) were fine-tuned for UI-specific component detection. These feature maps capture visual structures, edges, textures, and component boundaries. During detection, the region proposal network (RPN) identifies candidate regions (anchors) that are likely to contain UI components. Anchors are defined using multiple scales (128, 256, and 512) and aspect ratios (1:1, 1:2, and 2:1) to accommodate UI elements of varying sizes. During training, anchors with an intersection-over-union (IoU) greater than 0.7 with ground truth boxes are labeled as positive, while those with IoU less than 0.3 are labeled as negative; anchors with intermediate IoU values are ignored. Each anchor is assigned a probability indicating the presence of a component. Non-maximum suppression (NMS) is then applied to remove redundant and overlapping proposals, ensuring efficient localization of meaningful UI elements even in cluttered interfaces. Once candidate regions are generated, each proposal is classified into predefined component categories, and its bounding-box coordinates are refined. A region of interest (ROI) Align operation extracts fixed-size feature representations for each proposal, which are then processed by fully connected layers for classification and regression. The classification branch outputs class probabilities, while the regression branch predicts precise bounding-box coordinates. The entire Faster R-CNN model is trained end-to-end by optimizing a joint loss function that combines the RPN loss with the final detection loss. This enables the system to not only accurately recognize UI components but also precisely localize them across diverse interface structures. A detailed description of Faster R-CNN component detection, including the RPN stage, ROI classification, bounding-box refinement, and final optimization objective, is provided in Supplementary File 1.
Algorithm S1 provides the detailed component detection and structural extraction workflow (Supplementary File 1). It describes the complete process of automatic UI component detection and structural extraction from a raw screen image. The input image is first preprocessed and passed through a CNN backbone to extract deep visual features. These features are used by the RPN to generate candidate bounding boxes, which are then refined through classification and regression. NMS removes redundant detections to ensure accurate localization. Following detection, components are grouped based on spatial proximity using density-based spatial clustering of applications with noise (DBSCAN). This clustering step enables the construction of a hierarchical UI tree that captures parent–child relationships and logical groupings among components. This hierarchical representation forms the foundation for subsequent layout analysis and UI understanding. Figure 2 illustrates the Faster R-CNN component detection process on a mobile UI screen. The input interface (left) contains UI elements such as buttons and text blocks, which are automatically enclosed within bounding boxes. These detected regions are then classified into component categories (e.g., Button and Text), as indicated by labeled connections. The Faster R-CNN detection module (right) refines bounding-box coordinates, assigns semantic labels, and outputs structured component-level information. This step serves as a critical foundation for downstream processes, including layout extraction, cognitive optimization, and UI prototype generation, by providing accurate, semantically meaningful representations of UI components.

Figure 2. Component detection of user interface elements using Faster R-CNN. The figure illustrates the detection of UI components from an input interface screenshot. Regions of interest are identified using bounding boxes, and elements such as buttons and text fields are classified using Faster R-CNN. Arrows indicate the mapping of detected components to their corresponding semantic labels. Please click here to view a larger version of this figure.
Layout pattern extraction and hierarchical modeling
Following component detection using Faster R-CNN, each UI element is represented by a bounding box. However, these bounding boxes alone do not convey how elements are structurally organized within the interface, for example, which elements belong to headers, navigation bars, or grouped content regions. To address this limitation, the detected components are transformed into a logical UI tree, where each component is treated as a node and functionally or visually related components are grouped under common parent nodes. To identify meaningful layout groups, clustering techniques such as DBSCAN or hierarchical agglomerative clustering are applied. These methods analyze spatial proximity and alignment patterns among components to detect relationships between UI elements. In a manner analogous to human design practices, the system learns to recognize common structural patterns such as headers, footers, grids, and content blocks. Once grouping is established, additional structural properties—including alignment, grid organization, and reading order—are analyzed to construct a comprehensive layout representation. For example, components aligned in equal-width columns may indicate a card-based layout, whereas vertically stacked elements may indicate a form- or feed-based interface. By integrating clustering, spatial reasoning, and alignment rules, the framework constructs a hierarchical UI tree that captures both visual grouping and functional relationships. This hierarchical representation serves as the foundation for subsequent layout refinement and multiscreen consistency modeling, enabling the system to generate structured, coherent, and user-centered interface designs.
Detailed formulations for spatial distance and alignment similarity are provided in Supplementary File 1.
Clustering for layout grouping (DBSCAN)
To identify layout groups, DBSCAN is applied. DBSCAN uses two parameters: (1) ε = maximum distance between neighboring components and (2) = minimum number of components required to form a cluster. For this analysis, the DBSCAN parameters were empirically selected based on the normalized UI resolution (480 × 800 pixels). The neighborhood distance parameter was set to ε = 50 pixels to capture spatial proximity between adjacent UI components. The minimum number of points required to form a cluster was set to MinPts = 3 to avoid the formation of insignificant or spurious groups of UI components.
The detailed logical UI tree construction formulation is provided in Supplementary File 1.
Perceptual color modeling with CAM02-UCS
Perceptual color modeling ensures that colors used in the generated UI are harmonious, legible, and cognitively efficient. Dominant colors are extracted from input sources such as UI images using clustering techniques. Specifically, K-means clustering with and K-means++ initialization is applied for 300 iterations to obtain representative color palettes. However, the RGB color space does not accurately reflect human visual perception, meaning that numerically similar colors may appear perceptually different. To address this limitation, all extracted colors are transformed into CAM02-UCS, which is perceptually uniform. In this space, equal distances correspond to equal perceived color differences, making it suitable for modeling color harmony and contrast. Once mapped into CAM02-UCS, perceptual color differences are computed using Euclidean distance, enabling the system to quantify contrast, harmony, and variation between colors. Colors that are too similar are separated to improve legibility, while excessively contrasting colors are moderated to avoid visual discomfort. The generated palette also adheres to accessibility standards such as WCAG AA and AAA, ensuring sufficient contrast between foreground and background elements. Furthermore, color harmony is enforced by constraining palette relationships to complementary, analogous, or triadic schemes, depending on the intended UI theme. This ensures that the resulting color palette is not only visually appealing but also functionally accessible and cognitively optimized. To further refine the palette, an optimization process is applied under constraints of perceptual similarity, contrast, harmony, and brand consistency. A primary color is selected (e.g., from brand identity), and secondary colors are adjusted in terms of luminance and chroma to preserve visual hierarchy. A rule-based evaluation mechanism assesses candidate palettes based on perceptual distances and accessibility metrics, minimizing cognitive strain while maintaining aesthetic balance. As a result, the framework produces UI color schemes that exhibit professional-level coherence, readability, and perceptual consistency.
Detailed mathematical expressions for CAM02-UCS-based perceptual color modeling are provided in Supplementary File 1.
Algorithm S2 (Supplementary File 1) describes the CAM02-UCS-based perceptual color extraction and optimization workflow under harmony and accessibility constraints. Initially, dominant colors are extracted from the input image and transformed into CAM02-UCS to ensure that color differences correspond to human perception. Perceptual distances between colors are then computed and constrained within predefined bounds to maintain both clarity and harmony. Subsequently, accessibility is enforced by evaluating luminance contrast ratios according to WCAG guidelines. The final palette is obtained by optimizing a combined objective function that balances perceptual spacing, contrast requirements, and color harmony constraints. This ensures that the generated UI color schemes are not only visually appealing but also readable, accessible, and perceptually consistent.
Cognitive design optimization
Cognitive design optimization ensures that the automatically generated UI prototypes are not only visually consistent but also easy to understand and interact with. This module integrates key cognitive design principles, including Gestalt principles, Fitts’ law, and Hick’s law, to guide the arrangement, grouping, and spacing of UI components. Detailed mathematical formulations for cognitive design optimization are provided in Supplementary File 1.
Integrated cognitive optimization objective
The mathematical expression for the integrated cognitive optimization objective is provided in Supplementary File 1. Coefficients representing the importance of visual grouping, interaction efficiency, and decision complexity are denoted by alpha, beta, and gamma, respectively. In this study, the values of alpha, beta, and gamma were empirically determined using the validation dataset. For the present experiment, the coefficients were set as follows: α = 0.5, β = 0.3, and γ = 0.2. This configuration provides an effective balance between visual grouping, interaction efficiency, and decision simplicity.
Multiscreen consistency and UI generation
Multiscreen consistency modeling ensures that different screens within an application share a coherent visual identity, structural layout, and interaction pattern. As users navigate across screens, they develop expectations regarding element placement, typography, spacing, and visual hierarchy. To meet these expectations, the system analyzes cross-screen patterns using templates derived from the RICO and ENRICO datasets. These templates capture common UI structures such as home–detail layouts, list–detail patterns, multistep forms, and dashboard flows. By comparing component placement and grouping behavior, the system constructs a cross-screen structural profile that identifies which elements should remain consistent and which may vary. Once structural patterns are identified, the framework enforces consistency in typography scales, spacing ratios, grid layouts, and navigation anchors. For example, header bars maintain consistent height, primary buttons retain uniform size and alignment, and content blocks follow predictable visual ordering. This is achieved through a layout regularization process that evaluates each screen against global structural constraints. If a screen deviates from learned templates—such as inconsistent padding or misaligned titles—the system automatically adjusts the layout to restore coherence. These corrections help ensure a seamless UX and reduce cognitive switching costs across screens. The framework further analyzes the navigation graph between screens to maintain consistency in interaction flow. Common navigation patterns, including forward/backward transitions, tabbed navigation, and multistep workflows, are identified and enforced. Each transition is validated to ensure alignment with the user’s mental model, thereby improving usability and reducing confusion. As a result, the multiscreen consistency model minimizes visual noise, enhances familiarity, and promotes a unified interaction experience.
Detailed mathematical formulations for multiscreen consistency and UI generation are provided in Supplementary File 1.
Finally, the rendering engine generates visual outputs in formats such as SVG wireframes, HTML/CSS prototypes, or pixel-based UI mockups. The resulting UI screens exhibit correct reading order, harmonious color relationships, precise grid alignment, and consistent visual hierarchy across multiple screens.
Algorithm S3 provides the cognitive–visual layout optimization and multiscreen consistency workflow (Supplementary File 1). Algorithm S3 describes the integrated cognitive and structural optimization process used to generate user-friendly UI layouts. It combines perceptual grouping (Gestalt principles), interaction efficiency (Fitts’ law), and decision simplicity (Hick’s law) within a unified optimization framework. Initially, spatial relationships between components are evaluated to establish perceptual groupings. Interaction efficiency is then optimized by adjusting component size and placement, while decision complexity is controlled by limiting the number of choices presented to users. In addition, the algorithm enforces multiscreen consistency by aligning each screen with learned layout templates, ensuring uniformity in typography, spacing, and structural organization. A multiobjective optimization function then refines the layout by balancing alignment, spacing, and cognitive cost, resulting in an interface that is both visually coherent and cognitively efficient. Overall, this algorithm ensures that generated multiscreen layouts maintain high levels of visual consistency, usability, and perceptual clarity.