Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected async predict(imageData: ImageData) {
- const pred = await tf.tidy(() => {
- let img:any = tf.fromPixels(imageData, 1);
- img = img.reshape([1, 28, 28, 1]);
- img = tf.cast(img, 'float32');
- const output = this.model.predict(img) as any;
- this.predictions = Array.from(output.dataSync());
- });
- }
Add Comment
Please, Sign In to add comment