Created
November 15, 2020 14:31
-
-
Save aniketbiprojit/642dcb484e19197688f79778b76ee3ac to your computer and use it in GitHub Desktop.
Load Model in TFJS
This file contains hidden or 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
const tf = require('@tensorflow/tfjs-node') | |
const load_model = async () => { | |
const model = await tf.loadLayersModel( | |
'file:///path/to/directory/tfjs/model.json' | |
) | |
model.weights.forEach((w) => { | |
console.log(w.name, w.shape) | |
}) | |
model.compile({ | |
optimizer: 'sgd', | |
loss: 'categoricalCrossentropy', | |
metrics: ['accuracy'], | |
}) | |
return model | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment