Skip to content

Instantly share code, notes, and snippets.

@Marina-Miranovich
Created November 14, 2018 20:42
Show Gist options
  • Save Marina-Miranovich/4834f20be080926e7f02ecbc59fa7e0e to your computer and use it in GitHub Desktop.
Save Marina-Miranovich/4834f20be080926e7f02ecbc59fa7e0e to your computer and use it in GitHub Desktop.
code_snippet_3 for "Playing Mortal Kombat with TensorFlow.js. Transfer learning and data augmentation" translation
export const loadModel = async () => {
const mn = new mobilenet.MobileNet(1, 1);
mn.path = `file://PATH/TO/model.json`;
await mn.load();
return (input): tf.Tensor1D =>
mn.infer(input, 'global_average_pooling2d_1')
.reshape([1024]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment