Created
September 5, 2019 08:50
-
-
Save NMZivkovic/ab0f3f823d2eb49d671f9516a5a9b767 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private getImage(canvasHtmlElement) | |
{ | |
this.context.drawImage(canvasHtmlElement, 0, 0, 28, 28); | |
let imageData = this.context.getImageData(0, 0, 28, 28); | |
let img = tf.browser.fromPixels(imageData, 1); | |
let imgtmp = img.reshape([1, 28, 28, 1]); | |
imgtmp = tf.cast(imgtmp, 'float32'); | |
return imgtmp; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment