-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathindex.html
178 lines (162 loc) · 10.4 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
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>JS AI Body Tracker v1.0.0</title>
<link href="data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAABkdJREFUWEfFl39wVNUVxz939+2PJITND2J+NW2gYAjIj5RVAlqlkSSMJjDaOoIt2NGORWmLP0CY0WqhdqZMpUVGwKrYqYoyjspoQiROYNQREdwgFBMkQRMUApufS3azyf54ezvvvWRNYNOkDgznn/fufed8z/eec+595wpGKdI134GMuwUhi4ACELlAUr+5B2Qz8DlS7EP0VglnzfnRQIuRlOTBW65GMa1BisVA/Ej6/d/9CLmTcGSDmF3V8L9shiUgXeWas/XAHwDLKB1fqBYCNgNPCGeFPxZGTALy87JJhMUuBFO/p+OhZpI6FHmbKKhsvBDvIgLyQNlPsIo9SNIuifMBEEEbQblAzKk8PBh3CAF95RGx/5I7H0zCJK8fHIkoAT3nkkOXLOzDhU9Lh+C6gZoYTOBp4JH6UyE+qQ9w/JsQLe1h+kKSOKuJrFQzBROtlDjtpDnMMeG7v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G5m7lQbc6fY9a0XS7RIHDoR4ONjAZrdYQIhydgEE5NzLNxcYGd8xlDSgJYCowhjQ17uWb0IjW14uV0NE7MXowdRLIVw2CgERRkm5iOwHtHeOIjmOyCuJVa/99l/OqnYd5bFZTlMmTj2/wpS/cludlZ+S3lRJtdOT4ll64feLL0eZW3ZdqS450ItKSVbd3zF0ePdTModw7zZ45iRn4TVEjsiwWCEo196+OBgG43NPczMd3D/LycgBpV91IeQL4lZlfcaBLTO12z+IlbzGQxF2Lbja+oau3Vbm00hN9tOdnocjkSjVz3vDXHG3UvzmT4CAeM/MC1vLMuXTMASm2wIVb1G65gvakhixUqNSCr3nWXPR24WLlvDzDmltJw6wZFPqnX1GXNKyc7N48iBaipe3qD/hMqKMjGZhm26hzQkOshoWrLWjgC+lKVMcP5Kt/l4z+v684YFS/Rnk+tVxnS9MuQXfNGChmvJdBKjaUrHLYAfPWAQqO4nUGoQ4NQWaDeiElO0zni4pnTAYOS23ATpCyEul4Zjn+pmV08rBH8TtFYAw5zho2nLoySu5MUkSuJKXs0G5++KXU4vLKLLdT3/LyX/peBwD5lVAAAAAElFTkSuQmCC"
rel="icon" type="image/x-icon"/>
<meta name="description"
content="JS AI Body Tracker - javascript library implementing body tracking with ANN models: MoveNet, PoseNet and Blase Pose"/>
<meta name="robots" content="index, follow"/>
<meta name="og:site_name" content="JS AI Body Tracker"/>
<meta name="og:type" content="website"/>
<meta name="og:title" content="JS AI Body Tracker"/>
<meta name="og:description"
content="JS AI Body Tracker - javascript library implementing body tracking with ANN models: MoveNet, PoseNet and Blase Pose"/>
<meta name="og:url" content="https://szczyglis.dev/js-ai-body-tracker"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/video.js/7.0.0/video-js.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/7.0.0/video.min.js"></script>
</head>
<body>
<div class="gh">
<div class="demo version-section"><a target="_blank" href="https://github.com/szczyglis-dev/js-ai-body-tracker"
class="github-corner" aria-label="View source on GitHub">
<svg width="80" height="80" viewBox="0 0 250 250"
style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true">
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
fill="currentColor" class="octo-body"></path>
</svg>
</a>
</div>
</div>
<div id="controls">
<form method="GET">
<div class="container">
<div class="row">
<div class="col-md-6">
<button type="button" id="source-camera" class="source-select btn btn-primary" data-source="camera" >WEBCAM</button>
<button type="button" id="source-video" class="source-select btn btn-primary" data-source="video" >VIDEO</button>
<button type="button" id="source-stream" class="source-select btn btn-primary" data-source="stream">STREAM (IPTV / m3u8)</button>
</div>
<div class="col-md-6">
<div class="input-group mb-2">
<div class="input-group-prepend">
<div class="input-group-text">
<span>MODEL</span>
</div>
</div>
<select name="model" id="model_select" class="form-control d-inline-block">
<option value="MoveNetSinglePoseLightning">2D only (FAST) singlepose (faster) / MoveNet </option>
<option value="MoveNetSinglePoseThunder">2D only (FAST) singlepose (slower) / MoveNet </option>
<option value="MoveNetMultiPoseLightning">2D only (FAST) multipose / MoveNet</option>
<option value="PoseNetMobileNetV1">2D only (SLOW) singlepose (faster) / PoseNet-MobileNetV1 </option>
<option value="PoseNetResNet50">2D only (SLOW) singlepose (slower) / PoseNet-ResNet50</option>
<option value="BlazePoseLite">2D + 3D singlepose (faster) / BlazePose</option>
<option value="BlazePoseHeavy">2D + 3D singlepose (slower) / BlazePose</option>
<option value="BlazePoseFull">2D + 3D singlepose (optimal) / BlazePose</option>
</select>
</div>
</div>
</div>
</div>
</form>
<button id="btn_toggle_ai" class="btn btn-secondary">AI TRACKING ON/OFF</button>
<button id="btn_toggle_video" class="btn btn-secondary">VIDEO ON/OFF</button>
<button id="btn_toggle_3d" class="btn btn-secondary">3D VIEW ON/OFF</button>
<button id="btn_toggle_debug" class="btn btn-secondary">DEBUG ON/OFF</button>
<div id="video_src_area" style="display:none" class="text-center mt-3">
<div class="container justify-content-center">
<form class="form-horizontal" onsubmit="return false;">
<div class="form-row justify-content-center">
<div class="col-10 text-right">
<div class="input-group mb-2">
<div class="input-group-prepend">
<div class="input-group-text">
<span id="video_src_prefix"></span>
</div>
</div>
<input class="form-control" id="video_src" type="text" value="">
</div>
</div>
<div class="col-auto">
<button id="btn_load_src" class="btn btn-primary">LOAD</button>
</div>
</div>
</form>
</div>
<div class="mt-2 text-center">
<b>Tip:</b> click on "PLAY" icon to play or change video source URL and click "LOAD" button.
</div>
</div>
</div>
<button id="btn_toggle_controls" class="btn btn-primary">SHOW/HIDE CONTROLS</button>
<div class="mt-2 text-center" id="status"></div>
<div id="wrapper" class="container-fluid">
<canvas id="canvas"></canvas>
<video id="video" class="video-js vjs-fluid vjs-default-skin" preload="metadata">
<source src="">
</video>
<div id="info_debug"></div>
<div id="info_counter"></div>
</div>
<div id="view_3d"></div>
<div class="footer"><b>JS AI BODY TRACKER</b> v.1.0.0 | © 2022 Marcin "szczyglis" Szczyglinski | <a href="https://github.com/szczyglis-dev/js-ai-body-tracker" target="_blank">GitHUB</a></div>
<!-- Load Tensor Flow -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-core"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-converter"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-webgl"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/pose-detection"></script>
<!-- Load three.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r134/three.min.js"></script>
<!-- Load scatter-gl.js -->
<script src="https://cdn.jsdelivr.net/npm/scatter-gl@0.0.13/lib/scatter-gl.min.js"></script>
<!-- Load tracker.js and app.js-->
<script src="./js/app.js"></script>
<script src="./js/tracker.js"></script>
<script>
let source = 'camera'; // camera|video|stream
let sourceVideo = '';
let defaultVideo = 'mp4/whatislove.mp4';
let defaultStream = 'https://multiplatform-f.akamaihd.net/i/multi/will/bunny/big_buck_bunny_,640x360_400,640x360_700,640x360_1000,950x540_1500,.f4v.csmil/master.m3u8';
let model = 'MoveNetSinglePoseLightning';
/*
^^^ available pre-defined models:
- MoveNetSinglePoseLightning
- MoveNetSinglePoseThunder
- MoveNetMultiPoseLightning
- PoseNetMobileNetV1
- PoseNetResNet50
- BlazePoseLite
- BlazePoseHeavy
- BlazePoseFull
*/
// initialize app
app.init();
// initialize AI tracker model
tracker.setModel(model);
tracker.autofit = true; // enable auto resize/fit
// set-up hooks
tracker.on('statuschange', function(msg) {
app.updateStatus(msg);
});
tracker.on('beforeupdate', function(poses) {
app.updateDebug(poses);
app.updateCounter(poses);
});
// config
tracker.elCanvas = '#canvas';
tracker.elVideo = '#video';
tracker.el3D = '#view_3d';
tracker.pointWidth = 6;
tracker.pointRadius = 8;
// run predictions
tracker.run(source);
</script>
</body>
</html>