-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
370 lines (346 loc) · 12.3 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
<!DOCTYPE html>
<html lang="en">
<head>
<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="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"
integrity="sha512-9usAa10IRO0HhonpyAIVpjrylPvoDwiPUiKdWk5t3PyolY1cOd4DSE0Ga+ri4AuTroPR5aQvXU9xC6qOPnzFeg=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="style.css">
<title>DoodleIt</title>
<!-- Importing p5.js library for drawing on canvas and capturing the image data -->
<script src="https://cdn.jsdelivr.net/npm/p5@1.4.2/lib/p5.js"></script>
<!-- Importing TensorFlow.js library for CNN functionality -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@2.0.0/dist/tf.min.js"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/d3/5.7.0/d3.min.js'></script>
<!-- Importing html2canvas.js library for Capturing screenshot of the webpage -->
<script src='html2canvas.js'></script>
<!-- Importing doodle.js file for the javascriptfunctions -->
<script src='doodle.js'></script>
<!-- Importing jquery.js, select2.min.js, select2.css file for word wrapping the drop down menu -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.js"></script>
<script src="https://cdn.jsdelivr.net/npm/leader-line@1.0.5/leader-line.min.js"></script>
<link rel="stylesheet" href="select2.css">
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
</head>
<body>
<div id="createImg" style="border:1px solid;">
<!--Nav Bar-->
<div class="navbar">
<div class="container flex">
<h1 class="logo">
<a href="index.html">DoodleIt </a>
</h1>
<nav>
<ul>
<!-- Tabs on Home screen to add more pages -->
<li><a href="index.html">Home</a></li>
<li><a href="Tutorial.html">Tutorial</a></li>
<!-- <li><a href="Tutorial.html">Tutorial</a></li> -->
</ul>
</nav>
</div>
</div>
<!-- Showcase-->
<div class="Showcase">
<div class="container flex">
<div class="canvas flex">
<p>
You can draw images of cat, sheep, apple, door,
cake and triangle!!
</p>
<div id="form">
Code-Name : <input type="text" id="name">
</div>
<div id="canvasContainer"></div>
<select class="select2 narrow wrap" id="select2">
<option value="prompt 1"> Choose a Challenge</option>
<option value="prompt 2">1. Draw a circle and see what object is recognized</option>
<option value="prompt 3">2. Draw circle and then two ears like a cat over it and see how it changes the
answer</option>
<option value="prompt 4">3. Draw circle and then a stem over it and see how it changes the answer</option>
<option value="prompt 5">4. Draw an oval and see what object is recognized</option>
<option value="prompt 6">5. Draw an oval and then draw a four lines like leg under it</option>
<option value="prompt 7">6. Draw an oval and then draw a four lines like candle over it</option>
<option value="prompt 8">7. Draw a vertical line and observe which feature maps get highlighted</option>
<option value="prompt 9">8. Draw a horizontal line and observe which feature maps get highlighted</option>
<option value="prompt 10">9. Draw a diagonal line and observe which feature maps get highlighted</option>
</select>
<div>
<button id="clear" onclick="doCapture();">Clear</button>
<input type="button" id="myBtn" value="SHOW LINES" onclick="tgl();">
<!--<button id="clear" onclick="visualize();">Neuralnetwork</button>-->
</div>
</div>
<div class="filter flex">
<div id='heading2'>Filters</div>
<div class="row flex">
<div id='text1'>1</div>
<div class="filter card">
<div id='Filter 1'></div>
</div>
</div>
<div class="row flex">
<div id='text2'>2</div>
<div class="filter card">
<div id='Filter 2'></div>
</div>
</div>
<div class="row flex">
<div id='text3'>3</div>
<div class="filter card">
<div id='Filter 3'></div>
</div>
</div>
<div class="row flex">
<div id='text4'>4</div>
<div class="filter card">
<div id='Filter 4'></div>
</div>
</div>
<div class="row flex">
<div id='text5'>5</div>
<div class="filter card">
<div id='Filter 5'></div>
</div>
</div>
<div class="row flex">
<div id='text6'>6</div>
<div class="filter card">
<div id='Filter 6'></div>
</div>
</div>
<div class="row flex">
<div id='text7'>7</div>
<div class="filter card">
<div id='Filter 7'></div>
</div>
</div>
<div class="row flex">
<div id='text8'>8</div>
<div class="filter card">
<div id='Filter 8'></div>
</div>
</div>
</div>
<div class="feature flex">
<div id='heading3'>Feature Maps</div>
<div class="row flex">
<div class="feature card">
<div id='Feature Map 1'></div>
</div>
<div id='textF1'>1</div>
</div>
<div class="row flex">
<div class="feature card">
<div id='Feature Map 2'></div>
</div>
<div id='textF2'>2</div>
</div>
<div class="row flex">
<div class="feature card">
<div id='Feature Map 3'></div>
</div>
<div id='textF3'>3</div>
</div>
<div class="row flex">
<div class="feature card">
<div id='Feature Map 4'></div>
</div>
<div id='textF4'>4</div>
</div>
<div class="row flex">
<div class="feature card">
<div id='Feature Map 5'></div>
</div>
<div id='textF5'>5</div>
</div>
<div class="row flex">
<div class="feature card">
<div id='Feature Map 6'></div>
</div>
<div id='textF6'>6</div>
</div>
<div class="row flex">
<div class="feature card">
<div id='Feature Map 7'></div>
</div>
<div id='textF7'>7</div>
</div>
<div class="row flex">
<div class="feature card">
<div id='Feature Map 8'></div>
</div>
<div id='textF8'>8</div>
</div>
</div>
<div class="images flex">
<div id='heading4'>Output Neurons</div>
<!-- <div id="hidden">
<h4>OUTPUT LAYER</h4> -->
<div class="row flex">
<div class="neuron card">
<!-- <img src="images/cat.png" alt="Cat" > -->
<h4 id="neuron1">CAT</h4>
</div>
<div id='cat'></div>
</div>
<div class="row flex">
<div class="neuron card">
<!-- <img src="images/sheep.png" alt="Sheep" > -->
<h4 id="neuron2">SHEEP</h4>
</div>
<div id='sheep'></div>
</div>
<div class="row flex">
<div class="neuron card">
<!-- <img src="images/apple.png" alt="Apple" > -->
<h4 id="neuron3">APPLE</h4>
</div>
<div id='apple'></div>
</div>
<div class="row flex">
<div class="neuron card">
<!-- <img src="images/door.png" alt="Door" > -->
<h4 id="neuron4">DOOR</h4>
</div>
<div id='door'></div>
</div>
<div class="row flex">
<div class="neuron card">
<!-- <img src="images/cake.png" alt="Cake" > -->
<h4 id="neuron5">CAKE</h4>
</div>
<div id='cake'></div>
</div>
<div class="row flex">
<div class="neuron card">
<!-- <img src="images/triangle.png" alt="Triangle" > -->
<h4 id="neuron6">TRIANGLE</h4>
</div>
<div id='triangle'></div>
</div>
</div>
<!--<div class="output flex">
<div class="output card">
<div id='cat' ></div>
</div>
<div class="output card">
<div id='sheep' ></div>
</div>
<div class="output card">
<div id='apple' ></div>
</div>
<div class="output card">
<div id='door' ></div>
</div>
<div class="output card">
<div id='cake' ></div>
</div>
<div class="output card">
<div id='triangle' ></div>
</div>
</div> -->
</div>
</div>
</div>
<script>
function doCapture() {
window.scrollTo(0, 0);
html2canvas(document.getElementById("createImg")).then(function (canvas) {
var name = document.getElementById("name").value;
var ajax = new XMLHttpRequest();
ajax.open("POST", "save-capture.php", true);
ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
ajax.send("image=" + canvas.toDataURL("image/jpeg", 0.9));
ajax.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
console.log(this.responseText);
}
};
});
// var dropDown = document.getElementById("prompts");
// dropDown.selectedIndex = 0;
const messageId1 = ['#cat', '#sheep', '#apple', '#door', '#cake', '#triangle']
for (var i = 0; i < messageId1.length; i++) {
select(messageId1[i]).html("");
}
background(255);
}
function createLeaderLines(){}
function tgl() {
var t = document.getElementById("myBtn");
if (t.value == "HIDE LINES") {
t.value = "SHOW LINES";
hide()
}
else {
t.value = "HIDE LINES";
show()
}
}
var leaderLineArray = [];
function show() {
for (var i = 1; i < 9; i++) {
var line = new LeaderLine(
//LeaderLine.mouseHoverAnchor(document.getElementById('Filter '+i)),
document.getElementById('Filter ' + i),
document.getElementById('Feature Map ' + i),
{ hide: false }
);
line.endPlug= 'arrow1',
line.endPlugSize= 2,
line.size = 1;
line.color = 'black';
line.path = 'straight';
leaderLineArray.push(line);
}
//console.log("heyyy "+leaderLineArray);
for (let i = 1; i <= 8; i++) {
featureToNeuron('textF' + i);
}
function featureToNeuron(featureMap) {
for (let i = 1; i <= 6; i++) {
var line = new LeaderLine(
document.getElementById(featureMap),
document.getElementById('neuron' + i),
{ hide: false }
);
line.endPlug= 'arrow1',
line.endPlugSize= 2,
line.path = 'straight';
line.color = 'black';
line.size = 1;
leaderLineArray.push(line);
}
}
}
function hide() {
for (var i = 0; i < leaderLineArray.length; i++){
leaderLineArray[i].remove();
}
leaderLineArray = [];
/*for (var i = 1; i < 9; i++) {
var line = new LeaderLine(
//LeaderLine.mouseHoverAnchor(document.getElementById('Filter '+i)),
document.getElementById('Filter ' + i),
document.getElementById('Feature Map ' + i),
{ hide: false }
);
line.size = 1;
line.color = 'white';
line.path = 'straight';
}*/
}
/*for (let i = 1; i <= 8; i++){
featureToNeuron('textF'+i);
}*/
$(function () {
var $select2 = $('.select2').select2({
containerCssClass: "wrap"
})
})
</script>
</body>
</html>