diff --git a/src/pages/detection-mixin.js b/src/pages/detection-mixin.js index 21b2c02..aad01eb 100644 --- a/src/pages/detection-mixin.js +++ b/src/pages/detection-mixin.js @@ -27,10 +27,12 @@ export default { async localDetect(imageData) { console.time('pre-process') const [modelWidth, modelHeight] = model.inputs[0].shape.slice(1, 3) + let gTense = null const input = tf.tidy(() => { - var gTense = tf.image.rgbToGrayscale(tf.image.resizeBilinear(tf.browser.fromPixels(imageData), [modelWidth, modelHeight])).div(255.0).expandDims(0) + gTense = tf.image.rgbToGrayscale(tf.image.resizeBilinear(tf.browser.fromPixels(imageData), [modelWidth, modelHeight])).div(255.0).expandDims(0) return tf.concat([gTense,gTense,gTense],3) }) + tf.dispose(gTense) console.timeEnd('pre-process') console.time('run prediction')