-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathindex.html
295 lines (270 loc) · 13.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-91864013-5"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-91864013-5');
</script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta content="summary" />
<meta content="Arbitrary Style Transfer with TF.js" />
<meta content="Paint yourself in the style of any painting, right in the browser." />
<title>Neural Style Transfer</title>
<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous">
<link rel="stylesheet" href="https://unpkg.com/beerslider/dist/BeerSlider.css">
<!-- Bootstrap core CSS -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet">
<script src="dist/bundle.js"></script>
</head>
<style>
body {
overflow-x: hidden;
width: 100%;
background: rgb(238, 174, 202);
background: radial-gradient(circle, rgba(238, 174, 202, 1) 0%, rgba(148, 187, 233, 1) 100%);
font-family: Bodoni MT, Didot, Didot LT STD, Hoefler Text, Garamond, Times New Roman, serif;
}
.centered {
margin: auto;
display: block;
}
#counter {
text-align: center;
color: black;
font-size: 24px;
}
.progress-title {
font-size: 18px;
font-weight: 700;
color: #000;
letter-spacing: 2px;
margin: 0 0 15px;
}
.progress {
height: 26px;
width: 60%;
background: rgba(0, 0, 0, 0.1);
border-radius: 0;
box-shadow: none;
margin-left: auto;
margin-right: auto;
margin-bottom: 40px;
overflow: visible;
position: relative;
}
.progress .progress-bar {
box-shadow: none;
border-radius: 0;
position: relative;
-webkit-animation: 2s linear 0s normal none infinite running progress-bar-stripes, animate-positive 1s;
animation: 2s linear 0s normal none infinite running progress-bar-stripes, animate-positive 1s;
}
.progress-bar .progress-value {
width: 50px;
height: 100%;
background: #000;
font-size: 15px;
font-weight: 600;
color: #fff;
position: absolute;
line-height: 27px;
top: 0;
left: 0;
}
.progress:after,
.progress .progress-bar:after,
.progress .progress-value:after {
content: "";
border-left: 13px solid rgba(0, 0, 0, 0.1);
border-top: 13px solid transparent;
border-bottom: 13px solid transparent;
position: absolute;
top: 0;
right: -13px;
}
.progress .progress-value:after {
border-left: 13px solid #000;
}
.progress.progress-green .progress-bar:after {
border-left-color: #5cb85c;
}
@-webkit-keyframes animate-positive {
0% {
width: 0;
}
}
@keyframes animate-positive {
0% {
width: 0;
}
}
</style>
<body>
<input type="file" id="file-select" style="display: none" accept="image/x-png,image/gif,image/jpeg" />
<!-- As a heading -->
<div class="jumbotron jumbotron-fluid py-4" style="text-align: center; color: aliceblue; background-color: #512DA8;">
<div class="container">
<h2>Neural Style Transfer</h2>
</div>
</div>
<div class="container">
<div class="container">
<div class="row my-4 justify-content-around">
<div class="col-lg-5 card border-dark" style="padding: 0; background-color: transparent;">
<h3 class="card-header bg-primary" style="text-align: center; color: azure; opacity: 0.6;"> Choose Content Image </h3>
<div class="card-body">
<img id="content-img" class="centered" src="images/newyork.jpg" height=256 width=100%></img>
<br>
<select id="content-select" class="centered custom-select">
<option value="" disabled>Select content</option>
<option value="pic">Take a picture</option>
<option value="file">Select from file</option>
<option value="building">building</option>
<option value="diana">diana</option>
<option value="golden_gate">golden gate</option>
<option value="tajmahal">taj mahal</option>
<option value="newyork" selected="selected">new york</option>
</select>
</div>
</div><br/>
<div class="col-lg-5 card border-dark" style="padding: 0; background-color: transparent;">
<h3 class="card-header bg-primary" style="text-align: center; color: azure; opacity: 0.6;"> Choose Style Image </h3>
<div class="card-body">
<img id="style-img" class="centered" crossorigin="anonymous" src="images/abstract.jpg" height=256 width=100%></img>
<br>
<select id="style-select" class="centered custom-select">
<option value="" disabled>Select a style</option>
<option value="file">Select from file</option>
<option value="udnie">udnie</option>
<option value="abstract" selected="selected">abstract</option>
<option value="swirl">swirl</option>
<option value="van_gogh">van gogh</option>
<option value="towers">towers</option>
<option value="landscape">landscape</option>
<option value="seaport">seaport</option>
<option value="zigzag">zigzag</option>
</select>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row my-4 justify-content-around">
<div class="col-md-5 card border-dark" style="padding: 0; background-color: transparent;">
<h6 class="card-header bg-primary" style="text-align: center; color: azure; opacity: 0.6;">Choose the Style Prediction Network</h6>
<div class="card-body" style="color: rgba(24, 25, 31, 0.8);">
<div>
The Style Prediction Network is the model which is able to apply any number of styles, even styles for which it was not trained. This network produces a vector of normalization parameters that represents the detected Style present in the Style Image and
applies them to the Style Transfer network to generate the Artwork.
</div><br/>
<select disabled id="model-select-style" class="centered custom-select">
<option value="mobilenet" selected="selected">Distilled MobileNet style model</option>
<option value="inception">Original Inception-v3 style model</option>
</select>
</div>
</div>
<div class="col-md-5 card border-dark" style="padding: 0; background-color: transparent;">
<h6 class="card-header bg-primary" style="text-align: center; color: azure; opacity: 0.6;">Choose the Style Transfer Network</h6>
<div class="card-body" style="color: rgba(24, 25, 31, 0.8);">
<div>
An optimizable Style Transfer Network, that takes the Original Image and generates the new Artistic Image, following the Encoder-Decoder design. An Image is first reduced to a set of high-level features that then can be expanded to recreate the image,
but in this case, with an artistic style applied.
</div><br/>
<select disabled id="model-select-transformer" class="centered custom-select">
<option value="separable" selected="selected">Separable Conv-2d Transformer</option>
<option value="original">Original Transformer model</option>
</select>
</div>
</div>
</div>
</div>
<br>
<div class="container">
<div class="row my-4">
<div class="centered">
<h4>Select the extent of stylization</h4>
</div>
<div class="col-md-8 col-12 offset-md-2">
<input type="range" min="0" max="100" value="100" class="custom-range centered" id="stylized-img-ratio">
</div>
</div>
<br>
<div class="row my-4">
<div class="col-md-6 offset-md-3">
<button disabled id="style-button" type="button" class="btn btn-primary btn-block">Loading stylization model. Please wait..</button>
</div>
<div class="col-md-1">
<button type="button" id="randomize" class="btn btn-light btn-block">
<i class="fas fa-random" data-toggle="tooltip" data-placement="top" title="Randomize parameters"></i>
</button>
</div>
</div>
<br>
<div id="result" style="display: none;">
<div class="progress progress-green">
<div id="Bar" class="progress-bar bg-success progress-bar-striped active">
<div id="percent" class="progress-value">0%</div>
</div>
</div>
<div id="counter" class="centered">Epochs: 0</div>
<br>
<div style="text-align: center;"><b><h1>Final Image</h1></b></div>
<canvas id="stylized" class="centered"></canvas>
<br>
<button id="btndownload" class="centered btn bg-success">Download</button><br>
<button id="btnshow" class="centered btn bg-success">Compare Images</button><br>
</div>
<div class="img-container col-md-6 offset-md-3 col-12" style="display: none; padding-bottom: 20px;">
<div id="slider" class="beer-slider" data-beer-label="after">
<img id="img_over" src="" style="height: 320px; width: 450px;">
<div class="beer-reveal" data-beer-label="before">
<img id="img_lower" src="images/newyork.jpg" style="height: 320px; width: 450px;">
</div>
</div>
</div>
</div>
<div class="container"><canvas id="hidden-canvas" style="display: none"></canvas></div>
<div class="modal fade" id="cam-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Take a snapshot!</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<video id="webcam-video" class="centered" width="500" height="375"></video>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="snap-button">Snap!</button>
</div>
</div>
</div>
</div>
</div>
<!-- JQuery -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- Bootstrap tooltips -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.4/umd/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/js/bootstrap.min.js"></script>
<script src="https://unpkg.com/beerslider/dist/BeerSlider.js"></script>
<script type="text/javascript">
$(function() {
$('[data-toggle="tooltip"]').tooltip()
})
</script>
</body>
</html>