-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
468 lines (413 loc) · 15.6 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
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
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
<!doctype html>
<html>
<head>
<link href="style.css" rel="stylesheet" />
<link href="table.css" rel="stylesheet" />
</head>
<body>
<div id="loading-overlay" class="loading-overlay">
<div class="loader"></div>
</div>
<div id="welcome-container" onclick="toggleWelcome()">
<div id="popup-container">
<h3>Grada</h3>
<div id="page-0" class="active">
<img id="demo-img" src="media/page-0.png" />
<div class="tips">
<div>
Grada is an interactive tool that lets you observe real-time
changes as you train a multilayer perceptron.
</div>
<div>Double-click on a layer to edit it.</div>
<div>
You can create or import datasets and apply flattening, min-max
normalization, and one-hot encoding operations.
</div>
<div>Double-click on the MLP to edit its properties.</div>
<div>
You can evaluate a model by connecting an input component, but to
train it, you'll also need to add an output component.
</div>
<div>
<span class="c-blue">Blue</span> represents neuron biases. <br />
<span class="c-cyan">Cyan</span> represents bias gradients.
</div>
</div>
</div>
<div id="page-1">
<img id="demo-img" src="media/page-1.png" />
<div class="tips">
<div>
In input and output layers,
<span class="c-yellow">yellow</span> represents fetched data, and
<span class="c-green">green</span> represents executed data.
</div>
<div>
Pressing 'E' while hovering over the MLP resets the coordinates of
its components.
</div>
<div>
Pressing 'R' while hovering over the digit input clears the grid.
</div>
<div>
Pressing 'Esc' closes the edit layer screen and the MLP edit
popup.
</div>
</div>
</div>
<div id="page-2">
<img src="media/page-2.png" width="100%" height="100%" />
<div class="tips">
<div>
You can add components to mlp to plot loss graph or see forward
pass calculations by pressing the
<span class="c-yellow">yellow</span> and
<span class="c-blue">blue</span> dots. To alternate between train
and evaluation loss graph simply change the mlp's mode.
</div>
<div>
All the numbers shown in the MLP represent the output for the
first record. To observe all outputs for the current batch (up to
5 records), use the calculationViewer component.
</div>
</div>
</div>
<div id="page-3">
<img src="media/page-3.png" width="90%" height="100%" />
<div class="tips">
<div>
Use the flattener component to flatten the dataset if you haven't
already done so while creating the dataset. It flattens the
incoming data and optionally augments it.
</div>
<div>
For example, in the MNIST dataset, you can crop the image into an
arbitrary number of parts and flatten it into a specified number.
You can also visulize the incoming data.
</div>
<div>
The data doesn't need to come from handwritten input; you can
connect the MNIST train-eval dataset if it hasn't been flattened.
</div>
</div>
</div>
<div id="page-4">
<img src="media/page-4.png" width="300px" height="350px" />
<div class="tips">
<div>
There is a pre-trained model that you can import in the
Handwritten Digits section. You can also evaluate it with your
real-time drawings. If you don't use data augmentation (meaning
your part number is 1), you don't need to use the grid output but
since averaging are done in that component and it highlights the
result, don't forget to connect it.
</div>
<div>
Source code is available on GitHub. Contributions, issues and
feature requests are welcome.
</div>
</div>
</div>
<div id="page-controls">
<img src="media/next.png" alt="" onclick="decrementPage(event)" />
<img src="media/next.png" alt="" onclick="incrementPage(event)" />
</div>
</div>
</div>
<div id="mlp-edit-container">
<div>
<label for="mlp-label">Name</label><br />
<input id="mlp-label" type="text" value="" />
</div>
<div>
<label for="mlp-lr">Learning Rate</label> <br />
<input id="mlp-lr" type="range" step="0.001" max="1" min="0" /> <br />
<input id="mlp-lr-number" type="number" step="0.001" />
</div>
<div>
<label for="mlp-momentum">Momentum</label> <br />
<input id="mlp-momentum" type="range" step="0.1" max="0.9" min="0.1" />
<br />
</div>
<div>
<label for="mlp-batch-size">Batch Size</label><br />
<input id="mlp-batch-size" type="range" value="" max="128" min="1" />
</div>
<div class="flex-center">
Error Func:
<select id="err-function-select" class="inp"></select>
</div>
<div>
<div id="mlp-mode">
Mode:
<input type="radio" id="mode-eval" name="mlp-mode" value="eval" />
<label for="mode-eval">eval</label>
<input type="radio" id="mode-train" name="mlp-mode" value="train" />
<label for="mode-train">train</label>
</div>
</div>
<button id="toggle-mlp-props" class="btn btn-cyan" type="button">
Hide Props
</button>
<button id="mlp-reset-btn" class="btn btn-orange" type="button">
Reset Coordinates
</button>
<button id="mlp-export-btn" class="btn btn-purple" type="button">
Export
</button>
<button id="mlp-delete-btn" class="btn btn-rose" type="button">
Delete
</button>
<img
id="mlp-layer-close"
class="cancel-icon"
src="media/close.png"
alt=""
width="20"
height="20"
/>
</div>
<div id="disable-background">
<div id="canvas-parent">
<div id="edit-panel">
<div id="layer-settings-container">
<div class="flex-center">
Layer name:
<input id="label-input" class="inp" type="" name="" value="" />
</div>
<div class="flex-center">
Act Func:
<select id="act-function-select" class="inp">
<option value="" selected>None</option>
</select>
</div>
</div>
<div class="layer-controls-grid">
<div id="info-message-container">
Layer will be display with
<span id="info-message"></span> neurons <br />
</div>
<div class="grid-item">
<span>Number of shown neurons: </span>
<input id="set-shown-neuron" type="range" min="1" max="100" />
<input
class="inp"
id="shown-neuron-inp"
type="text"
maxlength="4"
/>
</div>
<div class="grid-item">
<span>Number of neurons: </span>
<input
class="inp"
id="set-neuron-num"
type="text"
maxlength="4"
/>
<button class="btn btn-cyan grid-item" id="toggle-shrink-btn">
Expanded
</button>
<button
class="btn btn-blue grid-item"
id="save-btn"
type="button"
>
Save
</button>
</div>
</div>
<img
id="edit-layer-close"
class="cancel-icon"
src="media/close.png"
alt=""
width="25"
height="25"
/>
</div>
</div>
<div id="create-dataset-container">
<div class="flex-end">
<img
id="create-dataset-close"
class="cancel-icon"
src="media/close.png"
alt=""
width="25"
height="25"
onclick="closeCreateDataset()"
/>
</div>
<div id="scrollable-container"></div>
<div id="edit-dataset-container">
<div>
Name:
<input class="inp" id="edit-dataset-name" type="text" value="" />
</div>
<br />
<div class="edit-dataset-grid-container">
<div class="edit-dataset-grid-item">
xData Shape: <span id="x-shape"></span>
</div>
<button class="btn btn-blue" id="flat-btn">Flatten</button>
<button class="btn btn-blue" id="min-max-btn">
min-max Normalization
</button>
<div></div>
<div id="flat-progress-bar"></div>
<div id="normalize-progress-bar"></div>
<div class="edit-dataset-grid-item">
yData Shape: <span id="y-shape"></span>
</div>
<button class="btn btn-blue" id="one-hot-encode-btn">
One hot Encode
</button>
<div></div>
<div></div>
<div id="onehot-progress-bar" class="progress-bar"></div>
<div></div>
</div>
</div>
<div id="import-dataset-container">
<label id="import-dataset" for="import-dataset-inp">
<img src="./media/upload.png" alt="" width="100" height="100" />
Import Dataset
</label>
<input type="file" id="import-dataset-inp" accept=".json" />
<button id="mnist-train-button" class="btn btn-cyan">
Continue with MNIST
</button>
<button id="mnist-eval-button" class="btn btn-cyan">
Continue with eval MNIST
</button>
</div>
<div class="flex-between">
<input
type="checkbox"
class="dataset-checkbox"
id="chk"
onchange="toggleDatasetMode()"
/>
<label class="label" for="chk">
<div class="ball"></div>
</label>
<div class="flex-center gap-10">
<button id="download-dataset-btn" class="btn btn-blue">
Download
</button>
<button id="create-dataset-btn" class="btn btn-blue">Create</button>
</div>
</div>
</div>
</div>
<img
id="toggle-drawer"
class="active"
src="media/arrow.svg"
onclick="toggleDrawer()"
/>
<div
id="drawer"
class="active"
onmouseover="disableCanvas()"
onmouseout="enableCanvas()"
>
<div id="header">Datasets</div>
<div id="dataset-scrollable"></div>
<div id="header">Handwritten Digits</div>
<button class="btn btn-blue" onclick="createHandWritten()">
HandWritten Input
</button>
<button class="btn btn-purple" onclick="importHandwrittenModel()">
HandWritten Model
</button>
<div id="header">Others</div>
<button onclick="openCreateDataset()" class="btn btn-yellow">
Create Dataset
</button>
<button class="btn btn-orange" onclick="createFlattener()">
Add Flattener
</button>
<button class="btn btn-green" onclick="createLayer()">Add Layer</button>
<button
class="btn btn-sky"
id="import-mlp-btn"
onclick="triggerImportMlpInput()"
>
Import MLP
</button>
<input
type="file"
id="import-mlp-input"
oninput="readMLPFile(event)"
accept=".json"
class="hidden"
/>
<div id="footer">
<a href="https://github.com/saliherdemk/Grada" target="blank">
<img src="media/github.svg" alt="" />
</a>
<img class="pointer" src="media/tip.svg" onclick="toggleWelcome()" />
</div>
</div>
<script src="js/p5.min.js"></script>
<script src="js/helpers.js"></script>
<script src="js/script.js"></script>
<script src="js/Workers/flattenWorker.js"></script>
<script src="js/Workers/getMinMaxWorker.js"></script>
<script src="js/Workers/oneHotWorker.js"></script>
<script src="js/Workers/minMaxNormalizeWorker.js"></script>
<script src="js/Workers/DataProcessor.js"></script>
<script src="js/Managers/themeManager.js"></script>
<script src="js/Managers/canvasManager.js"></script>
<script src="js/Managers/interactionManager.js"></script>
<script src="js/Managers/eventManager.js"></script>
<script src="js/Managers/activationFunctionManager.js"></script>
<script src="js/Managers/errorFunctionManager.js"></script>
<script src="js/Organizers/Table/FunctionalTable.js"></script>
<script src="js/Organizers/Table/tableOrganizer.js"></script>
<script src="js/Organizers/datasetOrganizer.js"></script>
<script src="js/Organizers/mainOrganizer.js"></script>
<script src="js/Organizers/editOrganizer.js"></script>
<script src="js/Organizers/editLayerOrganizer.js"></script>
<script src="js/Organizers/editMlpOrganizer.js"></script>
<script src="js/MLP/Tensor.js"></script>
<script src="js/MLP/Dataset.js"></script>
<script src="js/MLP/DenseLayer.js"></script>
<script src="js/MLP/SGD.js"></script>
<script src="js/MLP/MlpParams.js"></script>
<script src="js/MLP/Mlp.js"></script>
<script src="js/draggable.js"></script>
<script src="js/Draw/Minors/LoadingIndicator.js"></script>
<script src="js/Draw/Minors/Buttons/CanvasButton.js"></script>
<script src="js/Draw/Minors/Buttons/ImageButton.js"></script>
<script src="js/Draw/Minors/Buttons/TextButton.js"></script>
<script src="js/Draw/Minors/Dot/Dot.js"></script>
<script src="js/Draw/Minors/Dot/FlattenInputDot.js"></script>
<script src="js/Draw/Minors/Dot/LayerDot.js"></script>
<script src="js/Draw/Minors/Dot/CalculationDot.js"></script>
<script src="js/Draw/Minors/Dot/LossGraphDot.js"></script>
<script src="js/Draw/Minors/WeightlessLine.js"></script>
<script src="js/Draw/Minors/Line.js"></script>
<script src="js/Draw/Minors/Viewers/Viewer.js"></script>
<script src="js/Draw/Minors/Viewers/CalculationViewer.js"></script>
<script src="js/Draw/Minors/Viewers/GraphViewer.js"></script>
<script src="js/Draw/Layer/BaseLayers/LayerView.js"></script>
<script src="js/Draw/Layer/BaseLayers/FunctionalLayerView.js"></script>
<script src="js/Draw/Layer/BaseLayers/Component.js"></script>
<script src="js/Draw/Layer/HiddenLayer.js"></script>
<script src="js/Draw/Layer/CopyLayer.js"></script>
<script src="js/Draw/Layer/BaseLayers/IOLayer.js"></script>
<script src="js/Draw/Layer/InputLayer.js"></script>
<script src="js/Draw/Layer/OutputLayer.js"></script>
<script src="js/HandWritten/DigitInputGrid.js"></script>
<script src="js/HandWritten/DigitInput.js"></script>
<script src="js/HandWritten/Flattener.js"></script>
<script src="js/HandWritten/DigitOutput.js"></script>
<script src="js/Draw/NeuronView.js"></script>
<script src="js/Draw/MLP/Playable.js"></script>
<script src="js/Draw/MLP/MLPView.js"></script>
<script src="js/canvas.js"></script>
</body>
</html>