-
Notifications
You must be signed in to change notification settings - Fork 37
/
index.html
60 lines (54 loc) · 1.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>AI object detection</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<link rel="stylesheet" href="style.css">
<script src="https://unpkg.com/[email protected]/dist/ml5.min.js" type="text/javascript"></script>
</head>
<body>
<h2 id="loadingText">Loading...</h2>
<!-- video with size of 0px because of chrome -->
<video playsinline autoplay muted controls="true" id="video"></video>
<br><br>
<canvas id="c1"></canvas>
<br><br>
<table>
<tr>
<td>AI:</td>
<td>
<div class="switch">
<label>
Off
<input type="checkbox" id="ai" disabled>
<span class="lever"></span>
On
</label>
</div>
</td>
</tr>
<tr>
<td>FPS:</td>
<td>
<p class="range-field">
<input type="range" id="fps" min="1" max="60" value="50">
</p>
</td>
</tr>
</table>
<script>
var modelIsLoaded = false;
// Create a ObjectDetector method
const objectDetector = ml5.objectDetector('cocossd', {}, modelLoaded);
// When the model is loaded
function modelLoaded() {
console.log("Model Loaded!");
modelIsLoaded = true;
}
</script>
<script src="video.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
</body>
</html>