MCPcopy
hub / github.com/tensorflow/tfjs-examples / init

Function init

webcam-transfer-learning/index.js:180–197  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

178});
179
180async function init() {
181 try {
182 webcam = await tfd.webcam(document.getElementById('webcam'));
183 } catch (e) {
184 console.log(e);
185 document.getElementById('no-webcam').style.display = 'block';
186 }
187 truncatedMobileNet = await loadTruncatedMobileNet();
188
189 ui.init();
190
191 // Warm up the model. This uploads weights to the GPU and compiles the WebGL
192 // programs so the first time we collect data from the webcam it will be
193 // quick.
194 const screenShot = await webcam.capture();
195 truncatedMobileNet.predict(screenShot.expandDims(0));
196 screenShot.dispose();
197}
198
199// Initialize the application.
200init();

Callers 1

index.jsFile · 0.70

Calls 3

loadTruncatedMobileNetFunction · 0.85
initMethod · 0.45
predictMethod · 0.45

Tested by

no test coverage detected