-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdeeplearn_style_transfer.html
More file actions
420 lines (344 loc) · 12.8 KB
/
deeplearn_style_transfer.html
File metadata and controls
420 lines (344 loc) · 12.8 KB
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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Google Analytics -->
<script async src="https://www.google-analytics.com/analytics.js"></script>
<script async src="assets/plugins/autotrack.js"></script>
<script>
window.ga = window.ga || function () {
(ga.q = ga.q || []).push(arguments)
};
ga.l = +new Date;
ga('create', 'UA-108549242-1', 'auto');
// Replace the following lines with the plugins you want to use.
// ga('require', 'eventTracker');
// ga('require', 'outboundLinkTracker');
// ga('require', 'urlChangeTracker');
// ...
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
<!-- Meta -->
<title>DeeplearnJS Practice -- Neural Style Transfer</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="favicon.ico">
<link href='https://fonts.googleapis.com/css?family=Roboto:400,500,400italic,300italic,300,500italic,700,700italic,900,900italic'
rel='stylesheet' type='text/css'>
<!-- Global CSS -->
<link rel="stylesheet" href="assets/plugins/bootstrap/css/bootstrap.min.css">
<!-- Plugins CSS -->
<link rel="stylesheet" href="assets/plugins/font-awesome/css/font-awesome.css">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<!-- Theme CSS -->
<link id="theme-style" rel="stylesheet" href="assets/css/styles.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.bundle.min.js"></script>
</head>
<style>
.main-wrapper {
background: #fff;
padding: 30px;
padding-right: 300px;
}
@media (max-width: 767px) {
.wrapper {
max-width: 95%;
}
.main-wrapper {
padding: 20px;
}
.main-wrapper .time {
position: static;
display: block;
margin-top: 10px;
}
}
.box {
width: 99%;
/* height: 200px; */
background: #FFF;
/* margin: 40px auto; */
}
.effect6 {
/* position: relative; */
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
}
.effect6:before,
.effect6:after {
content: "";
position: absolute;
z-index: -1;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
top: 50%;
bottom: 0;
left: 10px;
right: 10px;
border-radius: 100px / 10px;
}
.title {
align-items: center;
/* border-bottom: 1px solid rgba(0, 0, 0, 0.1); */
color: black;
display: flex;
/* font-weight: 500; */
/* height: 20px; */
/* min-height: 20px; */
/* padding-top: 10px; */
padding-bottom: 10px;
/* padding-left: 20px; */
text-transform: uppercase;
}
.subtitle {
font-size: 15px;
font-weight: bold;
}
.train-stats-message {
line-height: 1.67em;
}
.inference-example {
display: flex;
justify-content: flex-start;
margin-bottom: 10px;
}
.inference-example>* {
display: table-cell;
vertical-align: middle;
}
/* ----------------------------*/
#pagewrap {
padding: 5px;
width: 960px;
margin: 20px auto;
}
#content {
width: 420px;
float: left;
padding: 5px 15px;
}
#style {
width: 424px;
/* Account for margins + border values */
float: right;
padding: 5px 15px;
margin: 0px 5px 5px 5px;
}
footer {
clear: both;
padding: 0 15px;
}
#styleImg {
margin-bottom: 25px;
}
#train-button-container {
padding-bottom: 15px;
}
#activationsContainer,
#webcam-message,
#ssl-message {
text-align: center;
}
#webcam-message,
#load-error-message,
#ssl-message {
background-color: #fbb;
outline: 1px solid rgb(100, 0, 0);
width: 904px;
padding: 5px 0;
margin: 10px auto;
}
#imgContainer,
#className {
display: table-cell;
vertical-align: top;
}
#className {
padding-top: 40px;
}
#inference-canvas {
width: 800px;
}
#warning {
margin-left: 50px;
margin-right: 50px;
}
article {
background: #fafafa;
padding: 80px 0;
box-shadow: 0 0px 4px rgba(0, 0, 0, 0.1);
}
article h2,
article h3 {
margin: 60px 0 20px 0;
font-size: 22px;
font-weight: 500;
line-height: 1.45em;
color: rgba(0, 0, 0, 0.7);
}
article h3 {
margin: 40px 0 20px 0;
font-size: 18px;
}
article :first-child h2 {
margin-top: 0;
}
article p {
font-weight: 400;
font-size: 17px;
line-height: 1.6;
color: rgba(0, 0, 0, 0.7);
}
body {
margin: 0;
}
.l--body {
width: 550px;
margin-left: auto;
margin-right: auto;
}
</style>
<body onload="start()">
<!--Navigation bar-->
<div id="nav-placeholder">
</div>
<!--end of Navigation bar-->
<div class="wrapper" id="wrap">
<div class="sidebar-wrapper" style="min-height:600px">
<div class="contact-container container-block">
<div class="jumbotron">
<h2>
Deeplearnjs Practice</h2>
<p style='font-size:1.2em'>This demo is reproduced from deeplearnjs's
<a href="https://github.com/PAIR-code/deeplearnjs/tree/master/demos/fast-style-transfer">fast style tranfer demo</a> originally developed by
<a href="https://github.com/reiinakano">Reiichiro Nakano</a>
in typescript. Tested in Google Chrome.
</p>
</div>
<p>Last Update: 2018-1-5</p>
<p>
<a href="https://github.com/PAIR-code/deeplearnjs/blob/master/LICENSE">DeeplearnJS's Apache License</a>
</p>
</div>
</div>
<div class="main-wrapper" style="min-height:600px">
<a href="https://github.com/hma02/deeplearnjs-practice" class="github-corner" aria-label="View source on Github">
<svg width="80" height="80" viewBox="0 0 250 250" style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;"
aria-hidden="true">
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
fill="currentColor" class="octo-body"></path>
</svg>
</a>
<style>
.github-corner:hover .octo-arm {
animation: octocat-wave 560ms ease-in-out
}
@keyframes octocat-wave {
0%,
100% {
transform: rotate(0)
}
20%,
60% {
transform: rotate(-25deg)
}
40%,
80% {
transform: rotate(10deg)
}
}
@media (max-width:500px) {
.github-corner:hover .octo-arm {
animation: none
}
.github-corner .octo-arm {
animation: octocat-wave 560ms ease-in-out
}
}
</style>
<div class='item row'>
<div class="col-md-6 col-sm-12 col-xs-12" align="middle">
<img id="contentImg" />
<br>
<br>
<!-- <paper-slider id="sizeSlider" value="250" min="10" max="500"></paper-slider>
<paper-tooltip for="sizeSlider">
Adjusts size of the content image. Bigger sizes may result in better stylization of images, although will take up more memory
and time.
</paper-tooltip> -->
<label for="content-dropdown">Content</label>
<div class="form-group item row">
<div class="col-md-6 col-sm-6 col-xs-6">
<select class="form-control" id="content-dropdown">
</select>
</div>
<div class="col-md-6 col-sm-6 col-xs-6">
<label class="btn btn-default btn-file" id="sample-file-label">
<i class="fa fa-upload" aria-hidden="true"></i> Upload from file
<input type="file" id="fileSelect" style="display: none" accept="image/x-png,image/gif,image/jpeg" />
</label>
</div>
</div>
</div>
<div class="col-md-6 col-sm-12 col-xs-12" align="middle">
<img id="styleImg" />
<div class="form-group">
<label for="style-dropdown">Style</label>
<select class="form-control" id="style-dropdown">
</select>
</div>
</div>
</div>
<footer>
<div id="train-button-container" align="middle">
<input class="btn btn-primary btn-md" id="btnstart" type="submit" value="Start Style Transfer" />
</div>
<div id="canvasContainer" align="middle">
<canvas id="imageCanvas" width="1" height="1"></canvas>
</div>
</footer>
<div id="webcam-dialog" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Take a photo</h4>
</div>
<div class="modal-body">
<video id="webcamVideo" width="500" height="375"></video>
</div>
<div class="modal-footer buttons">
<!-- closeModal -->
<input class="btn btn-primary btn-md" id="closeModal" type="submit" value="Cancel" />
<!-- takePicButton -->
<input class="btn btn-primary btn-md" id="takePicButton" type="submit" value="Take the pic!" />
</div>
</div>
</div>
</div>
<canvas id="hiddenCanvas" style="display: none"></canvas>
<div id="load-error-message" style="display: none">
We could not find a webcam, attach one to view the full demo!
</div>
</div>
</div>
<!-- Javascript -->
<script type="text/javascript" src="assets/plugins/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>
<!-- custom js -->
<script type="text/javascript" src="assets/js/nav.js"></script>
<script>
$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
});
</script>
<script src="https://unpkg.com/deeplearn@0.4.0"></script>
<!-- detect browser support -->
<script src="deeplearnjs/support.js"></script>
<script src="deeplearnjs/utils.js"></script>
<script type="text/javascript" src="deeplearnjs/style_transfer/net.js"></script>
<script type="text/javascript" src="deeplearnjs/style_transfer/style_transfer.js"></script>
</body>
</html>