forked from webmachinelearning/webnn-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
192 lines (189 loc) · 10.1 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
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>WebNN Selfie Segmentation Example</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<link href='../common/css/style.css' rel='stylesheet'>
<link rel="icon" type="image/x-icon" href="../common/img/favicon/favicon.ico">
<link rel="apple-touch-icon" sizes="180x180" href="../common/img/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="../common/img/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="../common/img/favicon/favicon-16x16.png">
<link rel="manifest" href="../common/img/favicon/site.webmanifest">
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark">
<a href="../index.html">
<div class="logosvg" id="logosvg"></div>
</a>
<span class="navbar-brand">Selfie Segmentation</span>
<!-- <ul class="navbar-nav"></ul> -->
</nav>
<div class='container' id='container'>
<div class="card mt-2 mb-2">
<div class="card-body">
<div class="row mb-2 align-items-center justify-content-md-left">
<div class="col-1 col-md-4">
<span>TFLite Wasm Runtime</span>
</div>
<div class="col-md-auto">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="webnnDelegate">
<label class="custom-control-label" for="webnnDelegate">Enable WebNN Delegate</label>
</div>
</div>
</div>
<div class="row mb-2 align-items-center">
<div class="col-1 col-md-4">
<span><a href="https://google.github.io/mediapipe/solutions/selfie_segmentation#models">MediaPipe Selfie Segmentation Model</a></span>
</div>
<div class="col-md-auto">
<div class="btn-group-toggle" data-toggle="buttons" id="ssModelsBtns">
<label class="btn btn-outline-info">
<input type="radio" name="model" id="selfie_segmentation" autocomplete="off">General
</label>
<label class="btn btn-outline-info">
<input type="radio" name="model" id="selfie_segmentation_landscape" autocomplete="off">Landscape
</label>
</div>
</div>
</div>
<div class="row align-items-center">
<div class="col-1 col-md-4">
<span><a href="https://tfhub.dev/tensorflow/lite-model/deeplabv3/1/default/1">TFLite DeepLabV3 Model</a></span>
</div>
<div class="col-md-auto">
<div class="btn-group-toggle" data-toggle="buttons" id="deeplabModelBtns">
<label class="btn btn-outline-info">
<input type="radio" name="model" id="deeplabv3" autocomplete="off">DeepLabV3 (257 x 257)
</label>
</div>
</div>
</div>
</div>
</div>
<ul class='nav nav-tabs nav-justified mb-3' id='tabs' role='tablist'>
<li class='nav-item' id='img' role='presentation'>
<a class='nav-link active' data-toggle='tab' href='#imagetab' role='tab' aria-controls='ex3-tabs-1'
aria-selected='true'>IMAGE</a>
</li>
<li class='nav-item' id='cam' role='presentation'>
<a class='nav-link' data-toggle='tab' href='#cameratab' role='tab' aria-controls='ex3-tabs-2'
aria-selected='false'>LIVE CAMERA</a>
</li>
</ul>
<div class='tab-content clearfix' style='display: none;' id='progressmodel'>
<div class='loading-page'>
<div class='counter'>
<div class='loading'>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<p id='progressstep'>Loading model ...</p>
</div>
</div>
</div>
<div class='tab-content text-center mt-5 col-sm' id='hint'>
<h2 class="text-uppercase text-info">No model selected</h2>
<p class="font-weight-lighter">Please select model to start prediction.</p>
</div>
<div class='tab-content clearfix row' id='selfiesegmentation'>
<div class='icdisplay col-sm' style='display: none;'>
<div class='tab-pane text-center active col-sm'>
<div class='icdisplay'>
<div class='col-lg-12 col-xs-12 text-center'>
<div class='row mb-2 align-items-center justify-content-md-center'>
<span id='fps' class="badge badge-pill badge-success"></span>
</div>
<div class='row'>
<div class='col bt-3 mb-3' style='display: flex;'>
<canvas id='outputCanvas'></canvas>
</div>
</div>
</div>
</div>
</div>
</div>
<div class='shoulddisplay col-sm' style='display: none;'>
<div class='row mb-4 align-items-center justify-content-md-center'>
<ul class="list-inline list-pipe text-center" style='font-size: 0.9rem;'>
<li class="list-inline-item">
Load time: <span class='ir' id='loadTime'></span>
</li>
<li class="list-inline-item">
<span id='computeLabel'></span>
<span class='ir' id='computeTime'></span>
</li>
</ul>
</div>
<div class='row mb-3 align-items-center'>
<span>Backgrounds:</span>
</div>
<div class='row mb-4 align-items-center' data-select='blur'>
<div class='gallery' id='gallery'>
<div class='gallery-item'>
<svg class='gallery-image' viewBox="0 0 24 24" aria-hidden="true" id='no-img'>
<path
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12zm8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8z">
</path>
</svg>
</div>
<div class='gallery-item'>
<svg class='gallery-image' viewBox="0 0 24 24" aria-hidden="true" id='blur-img'>
<path
d="M6 13c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0 4c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0-8c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm-3 .5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zM6 5c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm15 5.5c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zM14 7c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm0-3.5c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zm-11 10c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm7 7c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm0-17c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zM10 7c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm0 5.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm8 .5c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0 4c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0-8c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0-4c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm3 8.5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zM14 17c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0 3.5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm-4-12c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0 8.5c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm4-4.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-4c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5z">
</path>
</svg>
</div>
<div class='gallery-item hl'><img class='gallery-image' id='00-img' src='./images/backgrounds/00.jpg' />
</div>
<div class='gallery-item'><img class='gallery-image' id='01-img' src='./images/backgrounds/01.jpg' />
</div>
<div class='gallery-item'><img class='gallery-image' id='02-img' src='./images/backgrounds/02.jpg' />
</div>
</div>
</div>
<div class='row mt-5' id='pickimage'>
<label class='btn btn-outline-info shoulddisplay' style='display: none;'>
<input type='file' id='imageFile' accept='image/*' hidden />
<span>Pick Image</span>
</label>
</div>
</div>
</div>
</div>
<footer class="text-muted text-center text-small mt-5">
<div id="badge"></div>
<div id="footer"></div>
</footer>
<img id='feedElement' hidden crossorigin='anonymous' src=''>
<video id='feedMediaElement' autoplay playsinline hidden></video>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"
integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"
integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf.min.js"
integrity="sha256-thVOvsS0U8X0/2twH3+6dCK3ZPTvgWgFSivgfpj5vQQ="
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf-backend-wasm.min.js"
integrity="sha256-L69bjMGAl0eP3GTV6t/NcwblWqvaW2OcOp/ITT7ZOjY="
crossorigin="anonymous"></script>
<script type="module" src="./main.js"></script>
<script type="module" src="../common/component/component.js"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-6TK7JD3KKY"></script>
<script src="../common/libs/gtag.js"></script>
</body>
</html>