GAN-CNN Model for Automated UI Image to HTML Code Generation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current automatic code generation methods for software development are inefficient, require significant learning, and have limited universality, making them unsuitable for rapid and widespread adoption in software development.

Innovation Solution

A method utilizing a generative adversarial network (GAN) and convolutional neural network (CNN) to generate web codes for user interfaces by constructing a mapping relationship between HTML element display effects and source codes, performing object recognition, and iteratively refining the generated codes to achieve high accuracy and wide applicability.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Extent of automation

If traditional automatic code generation methods (template-based, model-driven, etc.) are used, then code generation can be partially automated, but the methods require significant learning and have limited universality

Engineering Contradiction:
Improvecode generation automationVSAvoidmethod universality
Core Design Contradiction:
Extent of automationVSAdaptability or versatility

Solution Approach 1:

The patent replaces traditional mechanical code generation systems (templates, model-driven approaches) with a deep learning-based neural network system. The GAN and CNN models automatically learn code generation patterns from training data, eliminating the need for manual template configuration and model definition, thereby achieving both high automation and broad adaptability across different UI scenarios

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Solution Approach 2:

The patent transforms the code generation problem into a parameter optimization problem by training neural network models on large datasets. The system learns optimal parameters (weights, biases, network architecture) through iterative training, enabling the model to generalize to unseen UI designs and achieve high universality without requiring method-specific configuration

Inventive Principle:
Principle #35Parameter changes

2Extent of automation

If traditional automatic code generation methods are used, then some code generation can be automated, but the development process remains heavy and inefficient

Engineering Contradiction:
Improvecode generation automationVSAvoidsoftware development efficiency
Core Design Contradiction:
Extent of automationVSProductivity

Solution Approach 1:

The patent implements a self-service code generation system where the trained GAN-CNN model automatically generates complete, production-ready HTML and CSS code from UI design images without human intervention. The system handles the entire code generation pipeline including structure extraction, style transfer, and code output, eliminating the need for developers to manually write or configure generation rules

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The patent performs preliminary training of the neural network models on large datasets of UI designs and their corresponding code before actual code generation. This pre-training phase enables the model to learn complex patterns and relationships, so that during actual use, code can be generated rapidly and accurately without requiring developers to perform time-consuming setup or configuration

Inventive Principle:
Principle #10Preliminary action

3Extent of automation

If traditional automatic code generation methods are used, then code generation can be performed, but the use threshold is relatively high and they are not friendly to most developers

Engineering Contradiction:
Improvecode generation capabilityVSAvoiddeveloper friendliness
Core Design Contradiction:
Extent of automationVSEase of operation

Solution Approach 1:

The patent introduces a trained neural network model as an intermediary between UI design images and target code. Instead of requiring developers to directly work with complex generation rules and templates, the system uses the learned model to translate visual designs into code automatically, significantly lowering the skill threshold and making the tool accessible to developers of all skill levels

Inventive Principle:
Principle #24Intermediary (Mediator)

4Adaptability or versatility

If more learning is required to master traditional methods, then the methods can be applied, but the learning curve increases and adoption is limited

Engineering Contradiction:
Improvemethod applicabilityVSAvoidlearning time
Core Design Contradiction:
Adaptability or versatilityVSLoss of time

Solution Approach 1:

The patent replaces manual, rule-based code generation systems with an automated neural network system that learns from data rather than requiring users to learn complex rules. The model is trained offline on diverse UI examples, and during deployment, it automatically adapts to different design styles and patterns without requiring users to learn or configure anything, thereby eliminating the learning curve while maintaining broad applicability

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Data Source

PatentUS11579850B2Method for generating web code for UI based on a generative adversarial network and a convolutional neural network
Publication Date: 2023.02.14 UNIVERSITY OF CENTRAL FLORIDA RESEARCH FOUNDATION INC
  • US11579850B2 patent drawing
  • US11579850B2 patent drawing
  • US11579850B2 patent drawing

AI summary

Provided is a method for generating web codes for a user interface (UI) based on a generative adversarial network (GAN) and a convolutional neural network (CNN). The method includes steps described below. A mapping relationship between display effects of a HyperText Markup Language (HTML) element and source codes of the HTML element is constructed. A location of an HTML element in an image I is recognized. Complete HTML codes of the image I are generated. The similarity between manually-written HTML codes and the generated complete HTML codes and the similarity between the image I and an image I1 generated by the generated complete HTML codes are obtained. After training, an image-to-HTML-code generation model M is obtained. A to-be-processed UI image is input into the model M so as to obtain corresponding HTML codes. According to the method of the present disclosure, an image-to-HTML-code generation model M can be obtained.