Machine Learning-Based
Prototyping of Graphical User
Interfaces for Mobile Apps
IEEETransactions on Software Engineering
Journal First Presentation
ESEC/FSE’18
Thursday, November 8th, 2018
Kevin Moran,
Carlos Bernal Cardenas
Michael Curcio,
Richard Bonett,
& Denys Poshyvanyk
HOW CAN AUTOMATION IMPROVE SOFTWARE ENGINEERING?
HOW CAN AUTOMATION IMPROVE SOFTWARE ENGINEERING?
HOW CAN AUTOMATION IMPROVE SOFTWARE ENGINEERING?
HOW CAN AUTOMATION IMPROVE SOFTWARE ENGINEERING?
Make the instantiation of concepts as
frictionless as possible
HOW CAN AUTOMATION IMPROVE SOFTWARE ENGINEERING?
Make the instantiation of concepts as
frictionless as possible
Facilitate growing software organically
WE NEED DEVELOPER-CENTRIC AUTOMATION
!7
!7
Video Source: MKBHD
Video Source: MKBHD
Video Source: Google
Video Source: Google
MOBILE DEVELOPMENT CHALLENGES
MOBILE DEVELOPMENT CHALLENGES
Highly Competitive
App Marketplaces
MOBILE DEVELOPMENT CHALLENGES
Noisy Feedback
from
User Reviews
Highly Competitive
App Marketplaces
MOBILE DEVELOPMENT CHALLENGES
Noisy Feedback
from
User Reviews
Highly Competitive
App Marketplaces
Change/Fault
Prone APIs
MOBILE DEVELOPMENT CHALLENGES
Noisy Feedback
from
User Reviews
Highly Competitive
App Marketplaces
Pressure for
Frequent
Releases
Change/Fault
Prone APIs
RESEARCH PROBLEM
UI/UX DesignTeam DevelopmentTeam
RESEARCH PROBLEM
UI/UX DesignTeam DevelopmentTeam
RESEARCH PROBLEM
UI/UX DesignTeam DevelopmentTeam
Sketch
RESEARCH PROBLEM
UI/UX DesignTeam DevelopmentTeam
RESEARCH PROBLEM
UI/UX DesignTeam DevelopmentTeam
RESEARCH PROBLEM
UI/UX DesignTeam DevelopmentTeam
RESEARCH PROBLEM
UI/UX DesignTeam DevelopmentTeam
RESEARCH PROBLEM
UI/UX DesignTeam DevelopmentTeam
RESEARCH PROBLEM
UI/UX DesignTeam DevelopmentTeam
RESEARCH PROBLEM
UI/UX DesignTeam DevelopmentTeam
RESEARCH PROBLEM
UI/UX DesignTeam DevelopmentTeam
RESEARCH PROBLEM
UI/UX DesignTeam DevelopmentTeam
RESEARCH PROBLEM
UI/UX DesignTeam DevelopmentTeam
RESEARCH PROBLEM
UI/UX DesignTeam DevelopmentTeam
RESEARCH PROBLEM
UI/UX DesignTeam DevelopmentTeam
Prototype GUI Code
RESEARCH PROBLEM
UI/UX DesignTeam DevelopmentTeam
Prototype GUI Code
EXISTING WORK
• Utilizes a combination of
unsupervised ComputerVision
Techniques to Detect Components
• Binary Component Classification
(Text or Image)
• GUI-hierarchy generated using
heuristics
Reverse Engineering
Mobile App Interfaces*
*Tuan Anh Nguyen and Christoph Csallner. 2015. Reverse Engineering
Mobile Application User Interfaces with REMAUI, In Proceedings of the
2015 30th IEEE/ACM International Conference on Automated Software
Engineering (ASE '15)
Neural MachineTranslation
of Images to Code✦
✦Tony Beltramelli, “pix2code: Generating code from a graphical user
interface screenshot,” CoRR, vol. abs/1705.07962, 2017. [Online].
Available: http://arxiv.org/abs/1705.07962
• Utilizes a Deep-Learning Machine
Translation Approach to convert
Images into a DSL and then apps
• Only tested on a small synthetic
set of apps
• Requires a DSL that must be
maintained
EXISTING WORK
Commercial Solutions
FIRST PRINCIPLES
How does a developer translate a GUI mock-up into code?
FIRST PRINCIPLES
1. Detect or identify GUI-components that exist in a mock-up
How does a developer translate a GUI mock-up into code?
FIRST PRINCIPLES
1. Detect or identify GUI-components that exist in a mock-up
2. Classify these GUI-components into their constituent types
How does a developer translate a GUI mock-up into code?
FIRST PRINCIPLES
1. Detect or identify GUI-components that exist in a mock-up
2. Classify these GUI-components into their constituent types
3. Assemble the GUI-components into a hierarchy and
stipulate styles
How does a developer translate a GUI mock-up into code?
FIRST PRINCIPLES
FIRST PRINCIPLES
Detection
FIRST PRINCIPLES
ClassificationDetection
FIRST PRINCIPLES
AssemblyClassificationDetection
FIRST PRINCIPLES
AssemblyClassificationDetection— —
THE REDRAW FRAMEWORK
PHASE 1: GUI-COMPONENT DETECTION
ComputerVision-Based Detection*
*Tuan Anh Nguyen and Christoph Csallner. 2015. Reverse Engineering Mobile Application User Interfaces with REMAUI, In Proceedings of the
2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE '15)
Input Image
PHASE 1: GUI-COMPONENT DETECTION
ComputerVision-Based Detection*
*Tuan Anh Nguyen and Christoph Csallner. 2015. Reverse Engineering Mobile Application User Interfaces with REMAUI, In Proceedings of the
2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE '15)
Input Image
PHASE 1: GUI-COMPONENT DETECTION
ComputerVision-Based Detection*
*Tuan Anh Nguyen and Christoph Csallner. 2015. Reverse Engineering Mobile Application User Interfaces with REMAUI, In Proceedings of the
2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE '15)
Canny’s Edge
Detection
Input Image
PHASE 1: GUI-COMPONENT DETECTION
ComputerVision-Based Detection*
*Tuan Anh Nguyen and Christoph Csallner. 2015. Reverse Engineering Mobile Application User Interfaces with REMAUI, In Proceedings of the
2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE '15)
Canny’s Edge
Detection
Edge
Dilation
Input Image
PHASE 1: GUI-COMPONENT DETECTION
ComputerVision-Based Detection*
*Tuan Anh Nguyen and Christoph Csallner. 2015. Reverse Engineering Mobile Application User Interfaces with REMAUI, In Proceedings of the
2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE '15)
Canny’s Edge
Detection
Edge
Dilation
Contour
Bounding Boxes
Input Image
PHASE 1: GUI-COMPONENT DETECTION
ComputerVision-Based Detection*
*Tuan Anh Nguyen and Christoph Csallner. 2015. Reverse Engineering Mobile Application User Interfaces with REMAUI, In Proceedings of the
2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE '15)
Canny’s Edge
Detection
Edge
Dilation
Contour
Bounding Boxes
GUI-Component
Bounding Boxes
Input Image
PHASE 1: GUI-COMPONENT DETECTION
ComputerVision-Based Detection*
*Tuan Anh Nguyen and Christoph Csallner. 2015. Reverse Engineering Mobile Application User Interfaces with REMAUI, In Proceedings of the
2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE '15)
Canny’s Edge
Detection
Edge
Dilation
Contour
Bounding Boxes
GUI-Component
Bounding Boxes
Input Image
Credits to: Steven Walker & William Hollingsworth
PHASE 1: GUI-COMPONENT DETECTION
Parsing Mock-Up Metadata
Input Image
SketchSketch
MarkEtch
PHASE 1: GUI-COMPONENT DETECTION
Parsing Mock-Up Metadata
Input Image
SketchSketch
MarkEtch
Marketch
Parsing
Engine
PHASE 1: GUI-COMPONENT DETECTION
Parsing Mock-Up Metadata
Input Image
SketchSketch
MarkEtch
Marketch
Parsing
Engine
GUI-Component
Bounding Boxes
PHASE 2: GUI-COMPONENT CLASSIFICATION
Source: http://www.wildml.com/2015/11/understanding-convolutional-neural-networks-for-nlp/
PHASE 2: GUI-COMPONENT CLASSIFICATION
Source: http://www.wildml.com/2015/11/understanding-convolutional-neural-networks-for-nlp/
ConvNets or CNNs have revolutionized
the task of image classification
PHASE 2: GUI-COMPONENT CLASSIFICATION
Source: http://www.wildml.com/2015/11/understanding-convolutional-neural-networks-for-nlp/
ConvNets or CNNs have revolutionized
the task of image classification
Advanced approaches have reached
human-levels of classification accuracy
ASIDE: CNN BASICS
…
…
…
Progress Bar
TextView
Image Button
Spinner
w1
i…w1
j
w2
i…w2
j
ASIDE: CNN BASICS
…
…
…
Progress Bar
TextView
Image Button
Spinner
12 14 45 46
78 45 23 12
45 78 90 76
09 67 56 34
09 34 23 67
89 23 12 45
w1
i…w1
j
w2
i…w2
j
ASIDE: CNN BASICS
…
…
…
Progress Bar
TextView
Image Button
Spinner
12 14 45 46
78 45 23 12
45 78 90 76
09 67 56 34
09 34 23 67
89 23 12 45
w1
i…w1
j
w2
i…w2
j
ASIDE: CNN BASICS
…
…
…
Progress Bar
TextView
Image Button
Spinner
12 14 45 46
78 45 23 12
45 78 90 76
09 67 56 34
09 34 23 67
89 23 12 45
w1
i…w1
j
w2
i…w2
j
ASIDE: CNN BASICS
…
…
…
Progress Bar
TextView
Image Button
Spinner
12 14 45 46
78 45 23 12
45 78 90 76
09 67 56 34
09 34 23 67
89 23 12 45
w1
i…w1
j
w2
i…w2
j
ASIDE: CNN BASICS
…
…
…
Progress Bar
TextView
Image Button
Spinner
12 14 45 46
78 45 23 12
45 78 90 76
09 67 56 34
09 34 23 67
89 23 12 45
w1
i…w1
j
w2
i…w2
j
ASIDE: CNN BASICS
…
…
…
Progress Bar
TextView
Image Button
Spinner
12 14 45 46
78 45 23 12
45 78 90 76
09 67 56 34
09 34 23 67
89 23 12 45
w1
i…w1
j
w2
i…w2
j
ASIDE: CNN BASICS
…
…
…
Progress Bar
TextView
Image Button
Spinner
12 14 45 46
78 45 23 12
45 78 90 76
09 67 56 34
09 34 23 67
89 23 12 45
w1
i…w1
j
w2
i…w2
j
ASIDE: CNN BASICS
…
…
…
Progress Bar
TextView
Image Button
Spinner
12 14 45 46
78 45 23 12
45 78 90 76
09 67 56 34
09 34 23 67
89 23 12 45
w1
i…w1
j
w2
i…w2
j
ASIDE: CNN BASICS
…
…
…
Progress Bar
TextView
Image Button
Spinner
12 14 45 46
78 45 23 12
45 78 90 76
09 67 56 34
09 34 23 67
89 23 12 45
w1
i…w1
j
w2
i…w2
j
ASIDE: CNN BASICS
…
…
…
Progress Bar
TextView
Image Button
Spinner
12 14 45 46
78 45 23 12
45 78 90 76
09 67 56 34
09 34 23 67
89 23 12 45
w1
i…w1
j
w2
i…w2
j
ASIDE: CNN BASICS
…
…
…
Progress Bar
TextView
Image Button
Spinner
12 14 45 46
78 45 23 12
45 78 90 76
09 67 56 34
09 34 23 67
89 23 12 45
w1
i…w1
j
w2
i…w2
j
ASIDE: CNN BASICS
…
…
…
Progress Bar
TextView
Image Button
Spinner
12 14 45 46
78 45 23 12
45 78 90 76
09 67 56 34
09 34 23 67
89 23 12 45
w1
i…w1
j
w2
i…w2
j
ASIDE: CNN BASICS
…
…
…
Progress Bar
TextView
Image Button
Spinner
12 14 45 46
78 45 23 12
45 78 90 76
09 67 56 34
09 34 23 67
89 23 12 45
w1
i…w1
j
w2
i…w2
j
ASIDE: CNN BASICS
…
…
…
Progress Bar
TextView
Image Button
Spinner
1%
85 %
5%
9%
12 14 45 46
78 45 23 12
45 78 90 76
09 67 56 34
09 34 23 67
89 23 12 45
w1
i…w1
j
w2
i…w2
j
ASIDE: CNN BASICS
…
…
…
Progress Bar
TextView
Image Button
Spinner
1%
85 %
5%
9%
12 14 45 46
78 45 23 12
45 78 90 76
09 67 56 34
09 34 23 67
89 23 12 45
w1
i…w1
j
w2
i…w2
j
ASIDE: CNN BASICS
…
…
…
Progress Bar
TextView
Image Button
Spinner
1%
85 %
5%
9%
12 14 45 46
78 45 23 12
45 78 90 76
09 67 56 34
09 34 23 67
89 23 12 45
w1
i…w1
j
w2
i…w2
j
Calculate the Error
According to
Gradient Descent
ASIDE: CNN BASICS
…
…
…
Progress Bar
TextView
Image Button
Spinner
1%
85 %
5%
9%
12 14 45 46
78 45 23 12
45 78 90 76
09 67 56 34
09 34 23 67
89 23 12 45
w1
i…w1
j
w2
i…w2
j
Calculate the Error
According to
Gradient Descent
Backpropagate the Error
through the network
and update weights
PHASE 2: GUI-COMPONENT CLASSIFICATION
How can we extract a large enough dataset of training images?
PHASE 2: GUI-COMPONENT CLASSIFICATION
How can we extract a large enough dataset of training images?
Mining Software Repositories
PHASE 2: GUI-COMPONENT CLASSIFICATION
How can we extract a large enough dataset of training images?
Mining Software Repositories
Automated Dynamic Analysis
+
PHASE 2: GUI-COMPONENT CLASSIFICATION
PHASE 2: GUI-COMPONENT CLASSIFICATION
Software
Repo
Miner
PHASE 2: GUI-COMPONENT CLASSIFICATION
Software
Repo
Miner
Image
Button
Image
Image
Button
Image
Button
TextView
Image
Image
Button
GUI
Hierarchies
Labeled
ImagesExecution Engine
PHASE 2: GUI-COMPONENT CLASSIFICATION
ReDraw’s CNN Architecture
PHASE 3: GUI-HIERARCHY CONSTRUCTION
PHASE 3: GUI-HIERARCHY CONSTRUCTION
KNN GUI-Hierarchy
Determination
PHASE 3: GUI-HIERARCHY CONSTRUCTION
KNN GUI-Hierarchy
Determination
PHASE 3: GUI-HIERARCHY CONSTRUCTION
KNN GUI-Hierarchy
Determination
PHASE 3: GUI-HIERARCHY CONSTRUCTION
KNN GUI-Hierarchy
Determination
PHASE 3: GUI-HIERARCHY CONSTRUCTION
KNN GUI-Hierarchy
Determination
PHASE 3: GUI-HIERARCHY CONSTRUCTION
KNN GUI-Hierarchy
Determination
PHASE 3: GUI-HIERARCHY CONSTRUCTION
KNN GUI-Hierarchy
Determination
PHASE 3: GUI-HIERARCHY CONSTRUCTION
KNN GUI-Hierarchy
Determination
PHASE 3: GUI-HIERARCHY CONSTRUCTION
KNN GUI-Hierarchy
Determination
PHASE 3: GUI-HIERARCHY CONSTRUCTION
KNN GUI-Hierarchy
Determination
PHASE 3: GUI-HIERARCHY CONSTRUCTION
KNN GUI-Hierarchy
Determination
PHASE 3: GUI-HIERARCHY CONSTRUCTION
KNN GUI-Hierarchy
Determination
Generated
GUI-Hierarchy
PHASE 3:APPLICATION ASSEMBLY
Labeled GUI
Component
Hierarchy
PHASE 3:APPLICATION ASSEMBLY
GUI-Code
Generation
Color
Quantization
& Histogram
Analysis
Labeled GUI
Component
Hierarchy
PHASE 3:APPLICATION ASSEMBLY
GUI-Code
Generation
Color
Quantization
& Histogram
Analysis
GUI-Code
Generation
Color
Quantization
& Histogram
AnalysisLabeled GUI
Component
Hierarchy
Functional
Prototype
Application
PHASE 3:APPLICATION ASSEMBLY
Target Component
PHASE 3:APPLICATION ASSEMBLY
Target Component
0
20
40
60
80
Component Colors
PHASE 3:APPLICATION ASSEMBLY
Target Component
0
20
40
60
80
Component Colors
PHASE 3:APPLICATION ASSEMBLY
Target Component
0
20
40
60
80
Component Colors
EMPIRICAL STUDY
EMPIRICAL STUDY
• RQ1: CNN Accuracy? 

EMPIRICAL STUDY
• RQ1: CNN Accuracy? 

• RQ2: Hierarchy Similarity? 

EMPIRICAL STUDY
• RQ1: CNN Accuracy? 

• RQ2: Hierarchy Similarity? 

• RQ3: Visual Similarity? 

EMPIRICAL STUDY
• RQ1: CNN Accuracy? 

• RQ2: Hierarchy Similarity? 

• RQ3: Visual Similarity? 

• RQ4: Industrial Applicability?
STUDY 1: CNN CLASSIFIER ACCURACY
Context
8,655 Applications
14,382 Unique Screens
191,300 Labeled GUI
Component Images
ReDraw CNN Classifier
Supervised BoVW
Baseline
15 of the most widely used
GUI-componentTypes
STUDY 1: CNN CLASSIFIER ACCURACY
Data Augmentation
Automatically Generated
Synthetic Applications
Automatically Shift Color
of Components through
Hue Shifting
STUDY 1: CNN CLASSIFIER ACCURACY
GUI Type Total # (C) Tr (O) Tr (O+S) Valid Test
TextView 99,200 74,087 74,087 15,236 9,877
ImageView 53,324 39,983 39,983 7,996 5,345
Button 16,007 12,007 12,007 2,400 1,600
ImageButton 8,693 6,521 6,521 1,306 866
EditText 5,643 4,230 5,000 846 567
CheckedTextView 3,424 2,582 5,000 505 337
CheckBox 1,650 1,238 5,000 247 165
RadioButton 1,293 970 5,000 194 129
ProgressBar 406 307 5,000 60 39
SeekBar 405 304 5,000 61 40
NumberPicker 378 283 5,000 57 38
Switch 373 280 5,000 56 37
ToggleButton 265 199 5,000 40 26
RatingBar 219 164 5,000 33 22
Spinner 20 15 5,000 3 2
Total 191,300 143,170 187,598 29,040 19,090
STUDY 1:RESULTS
Confusion Matrix for BoVW Baseline
Total TV IV Bt S ET IBt CTV PB RB TBt CB Sp SB NP RBt
TV 9877 59% 4% 9% 1% 6% 2% 8% 6% 0% 1% 2% 0% 1% 0% 2%
IV 5345 4% 51% 4% 1% 2% 11% 2% 18% 1% 1% 3% 0% 2% 0% 2%
Bt 1600 6% 6% 59% 1% 5% 4% 7% 4% 0% 1% 1% 0% 0% 3% 1%
S 37 5% 0% 3% 65% 0% 0% 5% 22% 0% 0% 0% 0% 0% 0% 0%
ET 567 6% 2% 4% 1% 62% 1% 4% 15% 0% 0% 1% 0% 0% 4% 1%
IBt 866 2% 16% 3% 0% 2% 61% 1% 9% 1% 1% 2% 0% 1% 0% 3%
CTV 337 3% 1% 7% 1% 3% 0% 81% 1% 0% 0% 2% 0% 0% 0% 2%
PB 41 0% 24% 2% 0% 2% 5% 2% 54% 0% 0% 2% 2% 2% 0% 2%
RB 22 0% 5% 0% 0% 0% 0% 0% 27% 68% 0% 0% 0% 0% 0% 0%
TBt 26 7% 7% 19% 0% 0% 0% 11% 15% 0% 33% 0% 0% 0% 0% 7%
CB 165 4% 2% 3% 1% 2% 1% 2% 12% 1% 0% 72% 0% 0% 0% 1%
Sp 2 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 100% 0% 0% 0%
SB 39 0% 5% 0% 0% 0% 0% 0% 18% 3% 0% 5% 0% 68% 0% 3%
NP 40 3% 0% 5% 0% 3% 0% 5% 0% 0% 0% 0% 0% 0% 84% 0%
RBt 129 6% 3% 5% 1% 3% 0% 6% 18% 0% 1% 1% 0% 1% 0% 55%
STUDY 1:RESULTS
Confusion Matrix for BoVW Baseline
Total TV IV Bt S ET IBt CTV PB RB TBt CB Sp SB NP RBt
TV 9877 59% 4% 9% 1% 6% 2% 8% 6% 0% 1% 2% 0% 1% 0% 2%
IV 5345 4% 51% 4% 1% 2% 11% 2% 18% 1% 1% 3% 0% 2% 0% 2%
Bt 1600 6% 6% 59% 1% 5% 4% 7% 4% 0% 1% 1% 0% 0% 3% 1%
S 37 5% 0% 3% 65% 0% 0% 5% 22% 0% 0% 0% 0% 0% 0% 0%
ET 567 6% 2% 4% 1% 62% 1% 4% 15% 0% 0% 1% 0% 0% 4% 1%
IBt 866 2% 16% 3% 0% 2% 61% 1% 9% 1% 1% 2% 0% 1% 0% 3%
CTV 337 3% 1% 7% 1% 3% 0% 81% 1% 0% 0% 2% 0% 0% 0% 2%
PB 41 0% 24% 2% 0% 2% 5% 2% 54% 0% 0% 2% 2% 2% 0% 2%
RB 22 0% 5% 0% 0% 0% 0% 0% 27% 68% 0% 0% 0% 0% 0% 0%
TBt 26 7% 7% 19% 0% 0% 0% 11% 15% 0% 33% 0% 0% 0% 0% 7%
CB 165 4% 2% 3% 1% 2% 1% 2% 12% 1% 0% 72% 0% 0% 0% 1%
Sp 2 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 100% 0% 0% 0%
SB 39 0% 5% 0% 0% 0% 0% 0% 18% 3% 0% 5% 0% 68% 0% 3%
NP 40 3% 0% 5% 0% 3% 0% 5% 0% 0% 0% 0% 0% 0% 84% 0%
RBt 129 6% 3% 5% 1% 3% 0% 6% 18% 0% 1% 1% 0% 1% 0% 55%
Overall Accuracy
65%
STUDY 1:RESULTS
Confusion Matrix for ReDraw CNN
Total TV IV Bt S ET IBt CTV PB RB TBt CB Sp SB NP RBt
TV 9877 94% 3% 2% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0%
IV 5345 5% 93% 1% 0% 0% 1% 0% 0% 0% 0% 0% 0% 0% 0% 0%
Bt 1600 11% 6% 81% 0% 1% 1% 0% 0% 0% 0% 0% 0% 0% 0% 0%
S 37 5% 3% 0% 87% 0% 0% 5% 0% 0% 0% 0% 0% 0% 0% 0%
ET 567 14% 3% 2% 0% 81% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0%
IBt 866 4% 23% 1% 0% 0% 72% 0% 0% 0% 0% 0% 0% 0% 0% 0%
CTV 337 7% 0% 0% 0% 0% 0% 93% 0% 0% 0% 0% 0% 0% 0% 0%
PB 41 15% 29% 0% 0% 0% 0% 0% 56% 0% 0% 0% 0% 0% 0% 0%
RB 22 0% 0% 0% 0% 0% 0% 0% 0% 100% 0% 0% 0% 0% 0% 0%
TBt 26 19% 22% 7% 0% 0% 0% 0% 0% 0% 52% 0% 0% 0% 0% 0%
CB 165 12% 7% 0% 0% 1% 0% 0% 0% 0% 0% 81% 0% 0% 0% 0%
Sp 2 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 100% 0% 0% 0%
SB 39 10% 13% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 78% 0% 0%
NP 40 0% 5% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 95% 0%
RBt 129 4% 3% 2% 0% 0% 0% 1% 0% 0% 0% 1% 0% 0% 0% 89%
STUDY 1:RESULTS
Confusion Matrix for ReDraw CNN
Total TV IV Bt S ET IBt CTV PB RB TBt CB Sp SB NP RBt
TV 9877 94% 3% 2% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0%
IV 5345 5% 93% 1% 0% 0% 1% 0% 0% 0% 0% 0% 0% 0% 0% 0%
Bt 1600 11% 6% 81% 0% 1% 1% 0% 0% 0% 0% 0% 0% 0% 0% 0%
S 37 5% 3% 0% 87% 0% 0% 5% 0% 0% 0% 0% 0% 0% 0% 0%
ET 567 14% 3% 2% 0% 81% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0%
IBt 866 4% 23% 1% 0% 0% 72% 0% 0% 0% 0% 0% 0% 0% 0% 0%
CTV 337 7% 0% 0% 0% 0% 0% 93% 0% 0% 0% 0% 0% 0% 0% 0%
PB 41 15% 29% 0% 0% 0% 0% 0% 56% 0% 0% 0% 0% 0% 0% 0%
RB 22 0% 0% 0% 0% 0% 0% 0% 0% 100% 0% 0% 0% 0% 0% 0%
TBt 26 19% 22% 7% 0% 0% 0% 0% 0% 0% 52% 0% 0% 0% 0% 0%
CB 165 12% 7% 0% 0% 1% 0% 0% 0% 0% 0% 81% 0% 0% 0% 0%
Sp 2 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 100% 0% 0% 0%
SB 39 10% 13% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 78% 0% 0%
NP 40 0% 5% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 95% 0%
RBt 129 4% 3% 2% 0% 0% 0% 1% 0% 0% 0% 1% 0% 0% 0% 89%
Overall Accuracy
91%
STUDY 2:GUI HIERARCHY CONSTRUCTION
Context
ReDraw
Pix2Code32 Applications
2-3 Unique Screens (Not
used inTraining the CNN)
REMAUI
(Re-implementation)
STUDY 2:GUI HIERARCHY CONSTRUCTION
Target
GUI Hierarchy
Prototype
GUI-Hierarchy
Edit
Distance
Calculation
# of Insertions - 0 < Insertion Penalty < 1
# of Deletions - 0 < Deletion Penalty < 1
# of Substitutions - 0 < Substitution Penalty < 1
STUDY 2:GUI HIERARCHY CONSTRUCTION
Target
GUI Hierarchy
Prototype
GUI-Hierarchy
Edit
Distance
Calculation
# of Insertions - 0 < Insertion Penalty < 1
# of Deletions - 0 < Deletion Penalty < 1
# of Substitutions - 0 < Substitution Penalty < 1
STUDY 2: RESULTS
Hierarchy Edit Distance to GroundTruth
A) Insertion Edits B) Deletion Edits C) Substitution Edits
Fraction of PenaltyFraction of PenaltyFraction of Penalty
EditDistance
EditDistance
EditDistance
STUDY 3:VISUAL SIMILARITY OF APPS
Context
ReDraw
Pix2Code32 Applications
2-3 Unique Screens (Not
used inTraining the CNN)
REMAUI
(Re-implementation)
STUDY 3:VISUAL SIMILARITY OF APPS
Target
App
Screenshot
Generated
App
Screenshot
Pixel-Based
Mean Average Error
(MAE)
Mean Squared Error
(MSE)
STUDY 3:VISUAL SIMILARITY OF APPS
Target
App
Screenshot
Generated
App
Screenshot
Pixel-Based
Mean Average Error
(MAE)
Mean Squared Error
(MSE)
STUDY 3: RESULTS
ReDraw−MU(MAE)
ReDraw−CV(MAE)
REMAUI(MAE)
Pix2Code(MAE)
ReDraw−MU(MSE)
ReDraw−CV(MSE)
REMAUI(MSE)
Pix2Code(MSE)
0.0 0.2 0.4 0.6 0.8
MSE and MAE compared to GroundTruth Screenshots
Mann Whitney U-Test & Cliff’s Delta
MAE MSE
Test p-Value d
ReDrawMU vs. ReDrawCV 0.835 0.02 (Small)
ReDrawMU vs. REMAUI 0.542 0.06 (Small)
ReDrawMU vs. pix2code <0.0002 -0.34 (Medium)
pix2code vs. ReDrawCV <0.0001 0.35 (Medium)
pix2code vs. REMAUI <0.0001 0.39 (Medium)
REMAUI vs. ReDrawCV 0.687 -0.04 (Small)
Test p-Value d
ReDrawMU vs. ReDrawCV 0.771 0.03 (Small)
ReDrawMU vs. REMAUI <0.0001 0.45 (Medium)
ReDrawMU vs. pix2code <0.003 -0.27 (Small)
pix2code vs. ReDrawCV <0.002 0.28 (Small)
pix2code vs. REMAUI <0.0001 0.61 (Large)
REMAUI vs. ReDrawCV <0.0001 -0.42 (Medium)
APPLICATIONS GENERATED BY REDRAW
A) Original Application B) ReDraw App (MockUp)
Textgram
APPLICATIONS GENERATED BY REDRAW
A) Original Application B) ReDraw App (MockUp)
Zillow
APPLICATIONS GENERATED BY REDRAW
A) Original Application B) ReDraw App (MockUp)
Bank of America
APPLICATIONS GENERATED BY REDRAW
A) Original Application B) ReDraw App (CV)
Giphy
APPLICATIONS GENERATED BY REDRAW
A) Original Application B) ReDraw App (CV)
Netflix
STUDY4: DEVELOPER UTILITY
Context
Mobile Front-End
Developer
Mobile Designer
9 Screens from 8
Popular Apps
Mobile Researcher
STUDY4: RESULTS
STUDY4: RESULTS
“It’s a good starting point... From a development
standpoint, the thing I would appreciate most is getting
a lot of the boilerplate code done [automatically]”
STUDY4: RESULTS
“It’s a good starting point... From a development
standpoint, the thing I would appreciate most is getting
a lot of the boilerplate code done [automatically]”
“There are going to be edge cases for different
layouts, but these are easily fixed after the fact”
STUDY4: RESULTS
“It’s a good starting point... From a development
standpoint, the thing I would appreciate most is getting
a lot of the boilerplate code done [automatically]”
“There are going to be edge cases for different
layouts, but these are easily fixed after the fact”
“The key thing is fast iteration.A developer could generate
the initial view [using ReDraw], clean up the layouts, and
have a working app. In the future, if a designer could upload
a screenshot, and without any other intervention [ReDraw]
could update the [existing] xml this would be ideal.”
https://www.android-dev-tools.com/redraw/
https://www.android-dev-tools.com/redraw/
https://www.android-dev-tools.com/redraw/
Carlos Bernal Cardenas
Michael Curcio
Richard Bonett
Denys Poshyvanyk
Any Questions?
Thank you!
Kevin Moran Ph.D.
Post-Doctoral Fellow
kpmoran@cs.wm.edu
http://www.cs.wm.edu/~kpmoran
ADDITIONAL SLIDES
“The essence of a software entity is a construct
of interlocking concepts: data sets, relationships
among data items, algorithms, and invocations
of functions. I believe the hard part of building
software to be the specification, design, and
testing of this conceptual construct, not the
labor of representing it and testing the fidelity of
the representation.”
– Fredrick Brooks, No Silver Bullet – Essence and
Accident in Software Engineering (1986)
DISTRIBUTION OF GUI COMPONENTS IN DATASET

Machine Learning-Based Prototyping of Graphical User Interfaces for Mobile Apps

  • 1.
    Machine Learning-Based Prototyping ofGraphical User Interfaces for Mobile Apps IEEETransactions on Software Engineering Journal First Presentation ESEC/FSE’18 Thursday, November 8th, 2018 Kevin Moran, Carlos Bernal Cardenas Michael Curcio, Richard Bonett, & Denys Poshyvanyk
  • 2.
    HOW CAN AUTOMATIONIMPROVE SOFTWARE ENGINEERING?
  • 3.
    HOW CAN AUTOMATIONIMPROVE SOFTWARE ENGINEERING?
  • 4.
    HOW CAN AUTOMATIONIMPROVE SOFTWARE ENGINEERING?
  • 5.
    HOW CAN AUTOMATIONIMPROVE SOFTWARE ENGINEERING? Make the instantiation of concepts as frictionless as possible
  • 6.
    HOW CAN AUTOMATIONIMPROVE SOFTWARE ENGINEERING? Make the instantiation of concepts as frictionless as possible Facilitate growing software organically
  • 7.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
    MOBILE DEVELOPMENT CHALLENGES HighlyCompetitive App Marketplaces
  • 18.
    MOBILE DEVELOPMENT CHALLENGES NoisyFeedback from User Reviews Highly Competitive App Marketplaces
  • 19.
    MOBILE DEVELOPMENT CHALLENGES NoisyFeedback from User Reviews Highly Competitive App Marketplaces Change/Fault Prone APIs
  • 20.
    MOBILE DEVELOPMENT CHALLENGES NoisyFeedback from User Reviews Highly Competitive App Marketplaces Pressure for Frequent Releases Change/Fault Prone APIs
  • 21.
  • 22.
  • 23.
    RESEARCH PROBLEM UI/UX DesignTeamDevelopmentTeam Sketch
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
    RESEARCH PROBLEM UI/UX DesignTeamDevelopmentTeam Prototype GUI Code
  • 36.
    RESEARCH PROBLEM UI/UX DesignTeamDevelopmentTeam Prototype GUI Code
  • 37.
    EXISTING WORK • Utilizesa combination of unsupervised ComputerVision Techniques to Detect Components • Binary Component Classification (Text or Image) • GUI-hierarchy generated using heuristics Reverse Engineering Mobile App Interfaces* *Tuan Anh Nguyen and Christoph Csallner. 2015. Reverse Engineering Mobile Application User Interfaces with REMAUI, In Proceedings of the 2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE '15) Neural MachineTranslation of Images to Code✦ ✦Tony Beltramelli, “pix2code: Generating code from a graphical user interface screenshot,” CoRR, vol. abs/1705.07962, 2017. [Online]. Available: http://arxiv.org/abs/1705.07962 • Utilizes a Deep-Learning Machine Translation Approach to convert Images into a DSL and then apps • Only tested on a small synthetic set of apps • Requires a DSL that must be maintained
  • 38.
  • 39.
    FIRST PRINCIPLES How doesa developer translate a GUI mock-up into code?
  • 40.
    FIRST PRINCIPLES 1. Detector identify GUI-components that exist in a mock-up How does a developer translate a GUI mock-up into code?
  • 41.
    FIRST PRINCIPLES 1. Detector identify GUI-components that exist in a mock-up 2. Classify these GUI-components into their constituent types How does a developer translate a GUI mock-up into code?
  • 42.
    FIRST PRINCIPLES 1. Detector identify GUI-components that exist in a mock-up 2. Classify these GUI-components into their constituent types 3. Assemble the GUI-components into a hierarchy and stipulate styles How does a developer translate a GUI mock-up into code?
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
    PHASE 1: GUI-COMPONENTDETECTION ComputerVision-Based Detection* *Tuan Anh Nguyen and Christoph Csallner. 2015. Reverse Engineering Mobile Application User Interfaces with REMAUI, In Proceedings of the 2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE '15) Input Image
  • 50.
    PHASE 1: GUI-COMPONENTDETECTION ComputerVision-Based Detection* *Tuan Anh Nguyen and Christoph Csallner. 2015. Reverse Engineering Mobile Application User Interfaces with REMAUI, In Proceedings of the 2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE '15) Input Image
  • 51.
    PHASE 1: GUI-COMPONENTDETECTION ComputerVision-Based Detection* *Tuan Anh Nguyen and Christoph Csallner. 2015. Reverse Engineering Mobile Application User Interfaces with REMAUI, In Proceedings of the 2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE '15) Canny’s Edge Detection Input Image
  • 52.
    PHASE 1: GUI-COMPONENTDETECTION ComputerVision-Based Detection* *Tuan Anh Nguyen and Christoph Csallner. 2015. Reverse Engineering Mobile Application User Interfaces with REMAUI, In Proceedings of the 2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE '15) Canny’s Edge Detection Edge Dilation Input Image
  • 53.
    PHASE 1: GUI-COMPONENTDETECTION ComputerVision-Based Detection* *Tuan Anh Nguyen and Christoph Csallner. 2015. Reverse Engineering Mobile Application User Interfaces with REMAUI, In Proceedings of the 2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE '15) Canny’s Edge Detection Edge Dilation Contour Bounding Boxes Input Image
  • 54.
    PHASE 1: GUI-COMPONENTDETECTION ComputerVision-Based Detection* *Tuan Anh Nguyen and Christoph Csallner. 2015. Reverse Engineering Mobile Application User Interfaces with REMAUI, In Proceedings of the 2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE '15) Canny’s Edge Detection Edge Dilation Contour Bounding Boxes GUI-Component Bounding Boxes Input Image
  • 55.
    PHASE 1: GUI-COMPONENTDETECTION ComputerVision-Based Detection* *Tuan Anh Nguyen and Christoph Csallner. 2015. Reverse Engineering Mobile Application User Interfaces with REMAUI, In Proceedings of the 2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE '15) Canny’s Edge Detection Edge Dilation Contour Bounding Boxes GUI-Component Bounding Boxes Input Image Credits to: Steven Walker & William Hollingsworth
  • 56.
    PHASE 1: GUI-COMPONENTDETECTION Parsing Mock-Up Metadata Input Image SketchSketch MarkEtch
  • 57.
    PHASE 1: GUI-COMPONENTDETECTION Parsing Mock-Up Metadata Input Image SketchSketch MarkEtch Marketch Parsing Engine
  • 58.
    PHASE 1: GUI-COMPONENTDETECTION Parsing Mock-Up Metadata Input Image SketchSketch MarkEtch Marketch Parsing Engine GUI-Component Bounding Boxes
  • 59.
    PHASE 2: GUI-COMPONENTCLASSIFICATION Source: http://www.wildml.com/2015/11/understanding-convolutional-neural-networks-for-nlp/
  • 60.
    PHASE 2: GUI-COMPONENTCLASSIFICATION Source: http://www.wildml.com/2015/11/understanding-convolutional-neural-networks-for-nlp/ ConvNets or CNNs have revolutionized the task of image classification
  • 61.
    PHASE 2: GUI-COMPONENTCLASSIFICATION Source: http://www.wildml.com/2015/11/understanding-convolutional-neural-networks-for-nlp/ ConvNets or CNNs have revolutionized the task of image classification Advanced approaches have reached human-levels of classification accuracy
  • 62.
    ASIDE: CNN BASICS … … … ProgressBar TextView Image Button Spinner w1 i…w1 j w2 i…w2 j
  • 63.
    ASIDE: CNN BASICS … … … ProgressBar TextView Image Button Spinner 12 14 45 46 78 45 23 12 45 78 90 76 09 67 56 34 09 34 23 67 89 23 12 45 w1 i…w1 j w2 i…w2 j
  • 64.
    ASIDE: CNN BASICS … … … ProgressBar TextView Image Button Spinner 12 14 45 46 78 45 23 12 45 78 90 76 09 67 56 34 09 34 23 67 89 23 12 45 w1 i…w1 j w2 i…w2 j
  • 65.
    ASIDE: CNN BASICS … … … ProgressBar TextView Image Button Spinner 12 14 45 46 78 45 23 12 45 78 90 76 09 67 56 34 09 34 23 67 89 23 12 45 w1 i…w1 j w2 i…w2 j
  • 66.
    ASIDE: CNN BASICS … … … ProgressBar TextView Image Button Spinner 12 14 45 46 78 45 23 12 45 78 90 76 09 67 56 34 09 34 23 67 89 23 12 45 w1 i…w1 j w2 i…w2 j
  • 67.
    ASIDE: CNN BASICS … … … ProgressBar TextView Image Button Spinner 12 14 45 46 78 45 23 12 45 78 90 76 09 67 56 34 09 34 23 67 89 23 12 45 w1 i…w1 j w2 i…w2 j
  • 68.
    ASIDE: CNN BASICS … … … ProgressBar TextView Image Button Spinner 12 14 45 46 78 45 23 12 45 78 90 76 09 67 56 34 09 34 23 67 89 23 12 45 w1 i…w1 j w2 i…w2 j
  • 69.
    ASIDE: CNN BASICS … … … ProgressBar TextView Image Button Spinner 12 14 45 46 78 45 23 12 45 78 90 76 09 67 56 34 09 34 23 67 89 23 12 45 w1 i…w1 j w2 i…w2 j
  • 70.
    ASIDE: CNN BASICS … … … ProgressBar TextView Image Button Spinner 12 14 45 46 78 45 23 12 45 78 90 76 09 67 56 34 09 34 23 67 89 23 12 45 w1 i…w1 j w2 i…w2 j
  • 71.
    ASIDE: CNN BASICS … … … ProgressBar TextView Image Button Spinner 12 14 45 46 78 45 23 12 45 78 90 76 09 67 56 34 09 34 23 67 89 23 12 45 w1 i…w1 j w2 i…w2 j
  • 72.
    ASIDE: CNN BASICS … … … ProgressBar TextView Image Button Spinner 12 14 45 46 78 45 23 12 45 78 90 76 09 67 56 34 09 34 23 67 89 23 12 45 w1 i…w1 j w2 i…w2 j
  • 73.
    ASIDE: CNN BASICS … … … ProgressBar TextView Image Button Spinner 12 14 45 46 78 45 23 12 45 78 90 76 09 67 56 34 09 34 23 67 89 23 12 45 w1 i…w1 j w2 i…w2 j
  • 74.
    ASIDE: CNN BASICS … … … ProgressBar TextView Image Button Spinner 12 14 45 46 78 45 23 12 45 78 90 76 09 67 56 34 09 34 23 67 89 23 12 45 w1 i…w1 j w2 i…w2 j
  • 75.
    ASIDE: CNN BASICS … … … ProgressBar TextView Image Button Spinner 12 14 45 46 78 45 23 12 45 78 90 76 09 67 56 34 09 34 23 67 89 23 12 45 w1 i…w1 j w2 i…w2 j
  • 76.
    ASIDE: CNN BASICS … … … ProgressBar TextView Image Button Spinner 1% 85 % 5% 9% 12 14 45 46 78 45 23 12 45 78 90 76 09 67 56 34 09 34 23 67 89 23 12 45 w1 i…w1 j w2 i…w2 j
  • 77.
    ASIDE: CNN BASICS … … … ProgressBar TextView Image Button Spinner 1% 85 % 5% 9% 12 14 45 46 78 45 23 12 45 78 90 76 09 67 56 34 09 34 23 67 89 23 12 45 w1 i…w1 j w2 i…w2 j
  • 78.
    ASIDE: CNN BASICS … … … ProgressBar TextView Image Button Spinner 1% 85 % 5% 9% 12 14 45 46 78 45 23 12 45 78 90 76 09 67 56 34 09 34 23 67 89 23 12 45 w1 i…w1 j w2 i…w2 j Calculate the Error According to Gradient Descent
  • 79.
    ASIDE: CNN BASICS … … … ProgressBar TextView Image Button Spinner 1% 85 % 5% 9% 12 14 45 46 78 45 23 12 45 78 90 76 09 67 56 34 09 34 23 67 89 23 12 45 w1 i…w1 j w2 i…w2 j Calculate the Error According to Gradient Descent Backpropagate the Error through the network and update weights
  • 80.
    PHASE 2: GUI-COMPONENTCLASSIFICATION How can we extract a large enough dataset of training images?
  • 81.
    PHASE 2: GUI-COMPONENTCLASSIFICATION How can we extract a large enough dataset of training images? Mining Software Repositories
  • 82.
    PHASE 2: GUI-COMPONENTCLASSIFICATION How can we extract a large enough dataset of training images? Mining Software Repositories Automated Dynamic Analysis +
  • 83.
    PHASE 2: GUI-COMPONENTCLASSIFICATION
  • 84.
    PHASE 2: GUI-COMPONENTCLASSIFICATION Software Repo Miner
  • 85.
    PHASE 2: GUI-COMPONENTCLASSIFICATION Software Repo Miner Image Button Image Image Button Image Button TextView Image Image Button GUI Hierarchies Labeled ImagesExecution Engine
  • 86.
    PHASE 2: GUI-COMPONENTCLASSIFICATION ReDraw’s CNN Architecture
  • 87.
  • 88.
    PHASE 3: GUI-HIERARCHYCONSTRUCTION KNN GUI-Hierarchy Determination
  • 89.
    PHASE 3: GUI-HIERARCHYCONSTRUCTION KNN GUI-Hierarchy Determination
  • 90.
    PHASE 3: GUI-HIERARCHYCONSTRUCTION KNN GUI-Hierarchy Determination
  • 91.
    PHASE 3: GUI-HIERARCHYCONSTRUCTION KNN GUI-Hierarchy Determination
  • 92.
    PHASE 3: GUI-HIERARCHYCONSTRUCTION KNN GUI-Hierarchy Determination
  • 93.
    PHASE 3: GUI-HIERARCHYCONSTRUCTION KNN GUI-Hierarchy Determination
  • 94.
    PHASE 3: GUI-HIERARCHYCONSTRUCTION KNN GUI-Hierarchy Determination
  • 95.
    PHASE 3: GUI-HIERARCHYCONSTRUCTION KNN GUI-Hierarchy Determination
  • 96.
    PHASE 3: GUI-HIERARCHYCONSTRUCTION KNN GUI-Hierarchy Determination
  • 97.
    PHASE 3: GUI-HIERARCHYCONSTRUCTION KNN GUI-Hierarchy Determination
  • 98.
    PHASE 3: GUI-HIERARCHYCONSTRUCTION KNN GUI-Hierarchy Determination
  • 99.
    PHASE 3: GUI-HIERARCHYCONSTRUCTION KNN GUI-Hierarchy Determination Generated GUI-Hierarchy
  • 100.
    PHASE 3:APPLICATION ASSEMBLY LabeledGUI Component Hierarchy
  • 101.
    PHASE 3:APPLICATION ASSEMBLY GUI-Code Generation Color Quantization &Histogram Analysis Labeled GUI Component Hierarchy
  • 102.
    PHASE 3:APPLICATION ASSEMBLY GUI-Code Generation Color Quantization &Histogram Analysis GUI-Code Generation Color Quantization & Histogram AnalysisLabeled GUI Component Hierarchy Functional Prototype Application
  • 103.
  • 104.
    PHASE 3:APPLICATION ASSEMBLY TargetComponent 0 20 40 60 80 Component Colors
  • 105.
    PHASE 3:APPLICATION ASSEMBLY TargetComponent 0 20 40 60 80 Component Colors
  • 106.
    PHASE 3:APPLICATION ASSEMBLY TargetComponent 0 20 40 60 80 Component Colors
  • 107.
  • 108.
    EMPIRICAL STUDY • RQ1:CNN Accuracy? 

  • 109.
    EMPIRICAL STUDY • RQ1:CNN Accuracy? 
 • RQ2: Hierarchy Similarity? 

  • 110.
    EMPIRICAL STUDY • RQ1:CNN Accuracy? 
 • RQ2: Hierarchy Similarity? 
 • RQ3: Visual Similarity? 

  • 111.
    EMPIRICAL STUDY • RQ1:CNN Accuracy? 
 • RQ2: Hierarchy Similarity? 
 • RQ3: Visual Similarity? 
 • RQ4: Industrial Applicability?
  • 112.
    STUDY 1: CNNCLASSIFIER ACCURACY Context 8,655 Applications 14,382 Unique Screens 191,300 Labeled GUI Component Images ReDraw CNN Classifier Supervised BoVW Baseline 15 of the most widely used GUI-componentTypes
  • 113.
    STUDY 1: CNNCLASSIFIER ACCURACY Data Augmentation Automatically Generated Synthetic Applications Automatically Shift Color of Components through Hue Shifting
  • 114.
    STUDY 1: CNNCLASSIFIER ACCURACY GUI Type Total # (C) Tr (O) Tr (O+S) Valid Test TextView 99,200 74,087 74,087 15,236 9,877 ImageView 53,324 39,983 39,983 7,996 5,345 Button 16,007 12,007 12,007 2,400 1,600 ImageButton 8,693 6,521 6,521 1,306 866 EditText 5,643 4,230 5,000 846 567 CheckedTextView 3,424 2,582 5,000 505 337 CheckBox 1,650 1,238 5,000 247 165 RadioButton 1,293 970 5,000 194 129 ProgressBar 406 307 5,000 60 39 SeekBar 405 304 5,000 61 40 NumberPicker 378 283 5,000 57 38 Switch 373 280 5,000 56 37 ToggleButton 265 199 5,000 40 26 RatingBar 219 164 5,000 33 22 Spinner 20 15 5,000 3 2 Total 191,300 143,170 187,598 29,040 19,090
  • 115.
    STUDY 1:RESULTS Confusion Matrixfor BoVW Baseline Total TV IV Bt S ET IBt CTV PB RB TBt CB Sp SB NP RBt TV 9877 59% 4% 9% 1% 6% 2% 8% 6% 0% 1% 2% 0% 1% 0% 2% IV 5345 4% 51% 4% 1% 2% 11% 2% 18% 1% 1% 3% 0% 2% 0% 2% Bt 1600 6% 6% 59% 1% 5% 4% 7% 4% 0% 1% 1% 0% 0% 3% 1% S 37 5% 0% 3% 65% 0% 0% 5% 22% 0% 0% 0% 0% 0% 0% 0% ET 567 6% 2% 4% 1% 62% 1% 4% 15% 0% 0% 1% 0% 0% 4% 1% IBt 866 2% 16% 3% 0% 2% 61% 1% 9% 1% 1% 2% 0% 1% 0% 3% CTV 337 3% 1% 7% 1% 3% 0% 81% 1% 0% 0% 2% 0% 0% 0% 2% PB 41 0% 24% 2% 0% 2% 5% 2% 54% 0% 0% 2% 2% 2% 0% 2% RB 22 0% 5% 0% 0% 0% 0% 0% 27% 68% 0% 0% 0% 0% 0% 0% TBt 26 7% 7% 19% 0% 0% 0% 11% 15% 0% 33% 0% 0% 0% 0% 7% CB 165 4% 2% 3% 1% 2% 1% 2% 12% 1% 0% 72% 0% 0% 0% 1% Sp 2 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 100% 0% 0% 0% SB 39 0% 5% 0% 0% 0% 0% 0% 18% 3% 0% 5% 0% 68% 0% 3% NP 40 3% 0% 5% 0% 3% 0% 5% 0% 0% 0% 0% 0% 0% 84% 0% RBt 129 6% 3% 5% 1% 3% 0% 6% 18% 0% 1% 1% 0% 1% 0% 55%
  • 116.
    STUDY 1:RESULTS Confusion Matrixfor BoVW Baseline Total TV IV Bt S ET IBt CTV PB RB TBt CB Sp SB NP RBt TV 9877 59% 4% 9% 1% 6% 2% 8% 6% 0% 1% 2% 0% 1% 0% 2% IV 5345 4% 51% 4% 1% 2% 11% 2% 18% 1% 1% 3% 0% 2% 0% 2% Bt 1600 6% 6% 59% 1% 5% 4% 7% 4% 0% 1% 1% 0% 0% 3% 1% S 37 5% 0% 3% 65% 0% 0% 5% 22% 0% 0% 0% 0% 0% 0% 0% ET 567 6% 2% 4% 1% 62% 1% 4% 15% 0% 0% 1% 0% 0% 4% 1% IBt 866 2% 16% 3% 0% 2% 61% 1% 9% 1% 1% 2% 0% 1% 0% 3% CTV 337 3% 1% 7% 1% 3% 0% 81% 1% 0% 0% 2% 0% 0% 0% 2% PB 41 0% 24% 2% 0% 2% 5% 2% 54% 0% 0% 2% 2% 2% 0% 2% RB 22 0% 5% 0% 0% 0% 0% 0% 27% 68% 0% 0% 0% 0% 0% 0% TBt 26 7% 7% 19% 0% 0% 0% 11% 15% 0% 33% 0% 0% 0% 0% 7% CB 165 4% 2% 3% 1% 2% 1% 2% 12% 1% 0% 72% 0% 0% 0% 1% Sp 2 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 100% 0% 0% 0% SB 39 0% 5% 0% 0% 0% 0% 0% 18% 3% 0% 5% 0% 68% 0% 3% NP 40 3% 0% 5% 0% 3% 0% 5% 0% 0% 0% 0% 0% 0% 84% 0% RBt 129 6% 3% 5% 1% 3% 0% 6% 18% 0% 1% 1% 0% 1% 0% 55% Overall Accuracy 65%
  • 117.
    STUDY 1:RESULTS Confusion Matrixfor ReDraw CNN Total TV IV Bt S ET IBt CTV PB RB TBt CB Sp SB NP RBt TV 9877 94% 3% 2% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% IV 5345 5% 93% 1% 0% 0% 1% 0% 0% 0% 0% 0% 0% 0% 0% 0% Bt 1600 11% 6% 81% 0% 1% 1% 0% 0% 0% 0% 0% 0% 0% 0% 0% S 37 5% 3% 0% 87% 0% 0% 5% 0% 0% 0% 0% 0% 0% 0% 0% ET 567 14% 3% 2% 0% 81% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% IBt 866 4% 23% 1% 0% 0% 72% 0% 0% 0% 0% 0% 0% 0% 0% 0% CTV 337 7% 0% 0% 0% 0% 0% 93% 0% 0% 0% 0% 0% 0% 0% 0% PB 41 15% 29% 0% 0% 0% 0% 0% 56% 0% 0% 0% 0% 0% 0% 0% RB 22 0% 0% 0% 0% 0% 0% 0% 0% 100% 0% 0% 0% 0% 0% 0% TBt 26 19% 22% 7% 0% 0% 0% 0% 0% 0% 52% 0% 0% 0% 0% 0% CB 165 12% 7% 0% 0% 1% 0% 0% 0% 0% 0% 81% 0% 0% 0% 0% Sp 2 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 100% 0% 0% 0% SB 39 10% 13% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 78% 0% 0% NP 40 0% 5% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 95% 0% RBt 129 4% 3% 2% 0% 0% 0% 1% 0% 0% 0% 1% 0% 0% 0% 89%
  • 118.
    STUDY 1:RESULTS Confusion Matrixfor ReDraw CNN Total TV IV Bt S ET IBt CTV PB RB TBt CB Sp SB NP RBt TV 9877 94% 3% 2% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% IV 5345 5% 93% 1% 0% 0% 1% 0% 0% 0% 0% 0% 0% 0% 0% 0% Bt 1600 11% 6% 81% 0% 1% 1% 0% 0% 0% 0% 0% 0% 0% 0% 0% S 37 5% 3% 0% 87% 0% 0% 5% 0% 0% 0% 0% 0% 0% 0% 0% ET 567 14% 3% 2% 0% 81% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% IBt 866 4% 23% 1% 0% 0% 72% 0% 0% 0% 0% 0% 0% 0% 0% 0% CTV 337 7% 0% 0% 0% 0% 0% 93% 0% 0% 0% 0% 0% 0% 0% 0% PB 41 15% 29% 0% 0% 0% 0% 0% 56% 0% 0% 0% 0% 0% 0% 0% RB 22 0% 0% 0% 0% 0% 0% 0% 0% 100% 0% 0% 0% 0% 0% 0% TBt 26 19% 22% 7% 0% 0% 0% 0% 0% 0% 52% 0% 0% 0% 0% 0% CB 165 12% 7% 0% 0% 1% 0% 0% 0% 0% 0% 81% 0% 0% 0% 0% Sp 2 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 100% 0% 0% 0% SB 39 10% 13% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 78% 0% 0% NP 40 0% 5% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 95% 0% RBt 129 4% 3% 2% 0% 0% 0% 1% 0% 0% 0% 1% 0% 0% 0% 89% Overall Accuracy 91%
  • 119.
    STUDY 2:GUI HIERARCHYCONSTRUCTION Context ReDraw Pix2Code32 Applications 2-3 Unique Screens (Not used inTraining the CNN) REMAUI (Re-implementation)
  • 120.
    STUDY 2:GUI HIERARCHYCONSTRUCTION Target GUI Hierarchy Prototype GUI-Hierarchy Edit Distance Calculation # of Insertions - 0 < Insertion Penalty < 1 # of Deletions - 0 < Deletion Penalty < 1 # of Substitutions - 0 < Substitution Penalty < 1
  • 121.
    STUDY 2:GUI HIERARCHYCONSTRUCTION Target GUI Hierarchy Prototype GUI-Hierarchy Edit Distance Calculation # of Insertions - 0 < Insertion Penalty < 1 # of Deletions - 0 < Deletion Penalty < 1 # of Substitutions - 0 < Substitution Penalty < 1
  • 122.
    STUDY 2: RESULTS HierarchyEdit Distance to GroundTruth A) Insertion Edits B) Deletion Edits C) Substitution Edits Fraction of PenaltyFraction of PenaltyFraction of Penalty EditDistance EditDistance EditDistance
  • 125.
    STUDY 3:VISUAL SIMILARITYOF APPS Context ReDraw Pix2Code32 Applications 2-3 Unique Screens (Not used inTraining the CNN) REMAUI (Re-implementation)
  • 126.
    STUDY 3:VISUAL SIMILARITYOF APPS Target App Screenshot Generated App Screenshot Pixel-Based Mean Average Error (MAE) Mean Squared Error (MSE)
  • 127.
    STUDY 3:VISUAL SIMILARITYOF APPS Target App Screenshot Generated App Screenshot Pixel-Based Mean Average Error (MAE) Mean Squared Error (MSE)
  • 128.
    STUDY 3: RESULTS ReDraw−MU(MAE) ReDraw−CV(MAE) REMAUI(MAE) Pix2Code(MAE) ReDraw−MU(MSE) ReDraw−CV(MSE) REMAUI(MSE) Pix2Code(MSE) 0.00.2 0.4 0.6 0.8 MSE and MAE compared to GroundTruth Screenshots Mann Whitney U-Test & Cliff’s Delta MAE MSE Test p-Value d ReDrawMU vs. ReDrawCV 0.835 0.02 (Small) ReDrawMU vs. REMAUI 0.542 0.06 (Small) ReDrawMU vs. pix2code <0.0002 -0.34 (Medium) pix2code vs. ReDrawCV <0.0001 0.35 (Medium) pix2code vs. REMAUI <0.0001 0.39 (Medium) REMAUI vs. ReDrawCV 0.687 -0.04 (Small) Test p-Value d ReDrawMU vs. ReDrawCV 0.771 0.03 (Small) ReDrawMU vs. REMAUI <0.0001 0.45 (Medium) ReDrawMU vs. pix2code <0.003 -0.27 (Small) pix2code vs. ReDrawCV <0.002 0.28 (Small) pix2code vs. REMAUI <0.0001 0.61 (Large) REMAUI vs. ReDrawCV <0.0001 -0.42 (Medium)
  • 129.
    APPLICATIONS GENERATED BYREDRAW A) Original Application B) ReDraw App (MockUp) Textgram
  • 130.
    APPLICATIONS GENERATED BYREDRAW A) Original Application B) ReDraw App (MockUp) Zillow
  • 131.
    APPLICATIONS GENERATED BYREDRAW A) Original Application B) ReDraw App (MockUp) Bank of America
  • 132.
    APPLICATIONS GENERATED BYREDRAW A) Original Application B) ReDraw App (CV) Giphy
  • 133.
    APPLICATIONS GENERATED BYREDRAW A) Original Application B) ReDraw App (CV) Netflix
  • 134.
    STUDY4: DEVELOPER UTILITY Context MobileFront-End Developer Mobile Designer 9 Screens from 8 Popular Apps Mobile Researcher
  • 135.
  • 136.
    STUDY4: RESULTS “It’s agood starting point... From a development standpoint, the thing I would appreciate most is getting a lot of the boilerplate code done [automatically]”
  • 137.
    STUDY4: RESULTS “It’s agood starting point... From a development standpoint, the thing I would appreciate most is getting a lot of the boilerplate code done [automatically]” “There are going to be edge cases for different layouts, but these are easily fixed after the fact”
  • 138.
    STUDY4: RESULTS “It’s agood starting point... From a development standpoint, the thing I would appreciate most is getting a lot of the boilerplate code done [automatically]” “There are going to be edge cases for different layouts, but these are easily fixed after the fact” “The key thing is fast iteration.A developer could generate the initial view [using ReDraw], clean up the layouts, and have a working app. In the future, if a designer could upload a screenshot, and without any other intervention [ReDraw] could update the [existing] xml this would be ideal.”
  • 139.
  • 140.
  • 141.
  • 147.
    Carlos Bernal Cardenas MichaelCurcio Richard Bonett Denys Poshyvanyk
  • 148.
    Any Questions? Thank you! KevinMoran Ph.D. Post-Doctoral Fellow kpmoran@cs.wm.edu http://www.cs.wm.edu/~kpmoran
  • 150.
  • 151.
    “The essence ofa software entity is a construct of interlocking concepts: data sets, relationships among data items, algorithms, and invocations of functions. I believe the hard part of building software to be the specification, design, and testing of this conceptual construct, not the labor of representing it and testing the fidelity of the representation.” – Fredrick Brooks, No Silver Bullet – Essence and Accident in Software Engineering (1986)
  • 154.
    DISTRIBUTION OF GUICOMPONENTS IN DATASET