Last active
January 15, 2020 14:54
-
-
Save vabarbosa/8bf676b8a16b3d9ef7716b064d3c1dd5 to your computer and use it in GitHub Desktop.
load tfjs model and run prediction
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
// load a graph model from a URL | |
const model = await tf.loadGraphModel(MODEL_URL) | |
// create a tensor from an image | |
const inputTensor = tf.browser.fromPixels(imageNode) | |
// run prediction | |
const prediction = model.predict(inputTensor) | |
// process output/prediction | |
const output = Array.from(prediction.dataSync()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment