-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathraw2.html
127 lines (77 loc) · 3.45 KB
/
raw2.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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>RAW </title>
<link rel="stylesheet" href="./public/css/styles.css">
<!-- <script type="text/javascript" src="./tf/tfjs.js"></script> -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"></script>
<!-- <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-converter"></script> -->
<!-- <script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]"></script> -->
</head>
<body>
<!-- <img style="display: none" id="cat" src="high-detail.jpg" width="224" height="224"> -->
<div>
<p> THIS HAS TO WORK</p>
</div>
<div id="container">
<video autoplay="true" id="videoElement">
</video>
<img id="pic" src="./img/Z.jpg" alt="Smiley face" height="244" width="244">
</div>
<footer>
<!-- for webcam -->
<script>
var video = document.querySelector("#videoElement");
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia ||
navigator.msGetUserMedia || navigator.oGetUserMedia;
if (navigator.getUserMedia) {
navigator.getUserMedia({
video: true
}, handleVideo, videoError);
}
function handleVideo(stream) {
video.src = window.URL.createObjectURL(stream);
}
function videoError(e) {
alert("error");
}
</script>
<script type="text/javascript" src="./index.js"></script>
<!-- <script>
// const MODEL_URL = './model/web_model.pb';
const MODEL_URL = './model/tensorflowjs_model.pb';
const WEIGHTS_URL = './model/weights_manifest.json';
// const MODEL_URL = 'https://storage-direct.y8.com/eddie/html5/canvas-friends/detail_js/tensorflowjs_model.pb';
// const WEIGHTS_URL = 'https://storage-direct.y8.com/eddie/html5/canvas-friends/detail_js/weights_manifest.json';
console.log('before loadFrozenModel')
async function loadModal() {
const model = await tf_converter.loadFrozenModel(MODEL_URL, WEIGHTS_URL);
console.log(model);
}
loadModal()
//const cat = document.getElementById('cat');
//model.execute({input: tf.fromPixels(cat)});
// let isPredictingm = true;
//THE LOOP FOR LOGGIN PREDICTIONS
// while (isPredicting) {
// const predictedClass = tf.tidy(() => {
// const img = webcam.capture();
// // const activation = mobilenet.predict(img);
// // const predictions = model.predict(activation);
// const predictions = model.predict(img);
// return predictions.as1D().argMax();
// });
// // console.log(predictedClass);
// const classId = (await predictedClass.data())[0];
// console.log(classId);
// // ui.predictClass(classId);
// await tf.nextFrame();
// // console.log('while predicting after load');
// }
</script> -->
</footer>
</body>
</html>