-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
index.html
230 lines (194 loc) · 7.51 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
<!--
Copyright 2018 Google LLC. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Webcam Pacman</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.cyan-teal.min.css" />
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
<script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
<link rel="stylesheet" href="./styles.css">
</head>
<body>
<header>
Turn your <b>Web Camera</b> into a controller using a <b>Neural Network</b>.
</header>
<div id="no-webcam">
No webcam found. <br/>
To use this demo, use a device with a webcam.
</div>
<!-- Top -->
<div id="pacman-container">
<div id="logo">
<div id="logo-l">
<div id="logo-b">
</div>
</div>
</div>
</div>
<div id="status">Loading mobilenet...</div>
<div class="controller-panels" id="controller" style="display:none">
<div class="panel training-panel">
<!-- Big buttons. -->
<div class="panel-row big-buttons">
<button id="train">
<img width="66" height="66" src="./images/button.svg" />
<span id="train-status">TRAIN MODEL</span>
</button>
<button id="predict">
<img width="66" height="66" src="./images/button.svg" />
<span>PLAY</span>
</button>
</div><!-- /.panel-row -->
<div class="panel-row params-webcam-row">
<!-- Hyper params. -->
<div class="hyper-params">
<!-- Learning rate -->
<div class="dropdown">
<label>Learning rate</label>
<div class="select">
<select id="learningRate">
<option value="0.00001">0.00001</option>
<option selected value="0.0001">0.0001</option>
<option value="0.01">0.001</option>
<option value="0.03">0.003</option>
</select>
</div>
</div>
<!-- Batch size -->
<div class="dropdown">
<label>Batch size</label>
<div class="select">
<select id="batchSizeFraction">
<option value="0.05">0.05</option>
<option value="0.1">0.1</option>
<option selected value="0.4">0.4</option>
<option value="1">1</option>
</select>
</div>
</div>
<!-- Epochs -->
<div class="dropdown">
<label>Epochs</label>
<div class="select">
<select id="epochs">
<option value="10">10</option>
<option selected value="20">20</option>
<option value="40">40</option>
</select>
</div>
</div>
<!-- Hidden units -->
<div class="dropdown">
<label>Hidden units</label>
<div class="select">
<select id="dense-units">
<option value="10">10</option>
<option selected value="100">100</option>
<option value="200">200</option>
</select>
</div>
</div>
</div><!-- /.hyper-params -->
<div class="webcam-box-outer">
<div class="webcam-box-inner">
<video autoplay playsinline muted id="webcam" width="224" height="224"></video>
</div>
</div>
</div><!-- /.panel-row -->
</div><!-- /.panel -->
<div class="panel joystick-panel">
<div class="panel-row panel-row-top">
<div class="panel-cell panel-cell-left panel-cell-fill">
<p class="help-text">
Click to add the <br/>
current camera <br/>
view as an example <br/>
for that control
</p>
</div><!-- ./panel-cell -->
<div class="panel-cell panel-cell-center">
<div class="thumb-box">
<div class="thumb-box-outer">
<div class="thumb-box-inner">
<canvas class="thumb" width=224 height=224 id="up-thumb"></canvas>
</div>
<button class="record-button" id="up"/><span>Add Sample</span></button>
</div>
<p>
<span id="up-total">0</span> examples
</p>
</div>
</div><!-- ./panel-cell -->
<div class="panel-cell panel-cell-right panel-cell-fill">
</div><!-- ./panel-cell -->
</div><!-- /.panel-row -->
<div class="panel-row panel-row-middle">
<div class="panel-cell panel-cell-left">
<div class="thumb-box">
<div class="thumb-box-outer">
<div class="thumb-box-inner">
<canvas class="thumb" width=224 height=224 id="left-thumb"></canvas>
</div>
<button class="record-button" id="left"/><span>Add Sample</span></button>
</div>
<p>
<span id="left-total">0</span> examples
</p>
</div>
</div><!-- ./panel-cell -->
<div class="panel-cell panel-cell-center panel-cell-fill">
<img height="108" width="129" src="./images/joystick.png" />
</div><!-- ./panel-cell -->
<div class="panel-cell panel-cell-right">
<div class="thumb-box">
<div class="thumb-box-outer">
<div class="thumb-box-inner">
<canvas class="thumb" width=224 height=224 id="right-thumb"></canvas>
</div>
<button class="record-button" id="right"/><span>Add Sample</span></button>
</div>
<p>
<span id="right-total">0</span> examples
</p>
</div>
</div><!-- ./panel-cell -->
</div><!-- /.panel-row -->
<div class="panel-row panel-row-bottom">
<div class="panel-cell panel-cell-left panel-cell-fill">
</div><!-- ./panel-cell -->
<div class="panel-cell panel-cell-center">
<div class="thumb-box">
<div class="thumb-box-outer">
<div class="thumb-box-inner">
<canvas class="thumb" width=224 height=224 id="down-thumb"></canvas>
</div>
<button class="record-button" id="down"/><span>Add Sample</span></button>
</div>
<p>
<span id="down-total">0</span> examples
</p>
</div>
</div><!-- ./panel-cell -->
<div class="panel-cell panel-cell-right panel-cell-fill">
</div><!-- ./panel-cell -->
</div><!-- /.panel-row -->
</div><!-- /.panel -->
</div><!-- /#controller -->
<p id="copyright">PAC-MAN™ © BANDAI NAMCO Entertainment Inc.</p>
<script src="https://storage.googleapis.com/tfjs-examples/assets/webcam-transfer-learning/pacman-google.js"></script>
<script type="module" src="index.js"></script>
</body>
</html>