-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
80 lines (75 loc) · 2.97 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
<head>
<title>Blink Detector</title>
<!-- Load required packages -->
<script src="https://cdn.jsdelivr.net/npm/three@0.106.2/build/three.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/scatter-gl@0.0.1/lib/scatter-gl.min.js"></script>
<style>
.canvas-wrapper, #scatter-gl-container {
display: inline-block;
vertical-align: top;
}
#scatter-gl-container {
border: solid 1px black;
position: relative;
}
/* center the canvas within its wrapper */
#scatter-gl-container canvas {
transform: translate3d(-50%, -50%, 0);
left: 50%;
top: 50%;
position: absolute;
}
</style>
<script>
</script>
</head>
<body>
<div>
<h1 style = "text-align:center;">Yawn Counter</h1>
<h2 style = "text-align:center;">Counts the number of yawns using Facial Keypoint Detection model</h2>
<h3 id = "yawnTag" style="text-align:center;">Yawns Counted = 0</h3>
</div>
<div id="main">
<div class="container">
<!-- Video Feed Container -->
<div class="canvas-wrapper">
<canvas id="output"></canvas>
<video id="video" playsinline style="
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
visibility: hidden;
width: auto;
height: auto;
">
</video>
</div>
<!-- Div to show facial landmarks -->
<div id="scatter-gl-container" style="left: 270px;"></div>
<div>
<b>Threshold</b>
<input type="range" id="rangeInput" value = 300 min="50" max="500" onchange="updateTextInput(this.value);">
<input type="text" id="textInput" value="300" onchange="updateRangeInput(this.value);">
</div>
<div>
<b>Show Prediction Mesh on Camera Feed</b>
<input type="checkbox" id="myCheck" onclick="updateCheck()">
</div>
</div>
</div>
<div id="chartContainer" style="height: 370px; width:100%;"></div>
</body>
<!-- Loading Tensorflow-JS package -->
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@2.6.0/dist/tf.js"></script>
<!-- Adds the WEBGL backend to the global backend registry -->
<script>tf.setBackend('webgl').then(() => console.log('webgl backend registered'));</script>
<!-- Load required Tensorflow-JS packages -->
<script src="https://unpkg.com/@tensorflow/tfjs-core@2.4.0/dist/tf-core.js"></script>
<script src="https://unpkg.com/@tensorflow/tfjs-converter@2.4.0/dist/tf-converter.js"></script>
<script src="https://unpkg.com/@tensorflow/tfjs-backend-webgl@2.4.0/dist/tf-backend-webgl.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm/dist/tf-backend-wasm.js"></script>
<script src="https://unpkg.com/@tensorflow-models/face-landmarks-detection@0.0.2/dist/face-landmarks-detection.js"></script>
<script src="stats.js"></script>
<script src="controller.js"></script>
<script src="index.js"></script>