Skip to content

Instantly share code, notes, and snippets.

@Marina-Miranovich
Created November 14, 2018 20:48
Show Gist options
  • Save Marina-Miranovich/0e86f661d7627fdda0e8124f55b63147 to your computer and use it in GitHub Desktop.
Save Marina-Miranovich/0e86f661d7627fdda0e8124f55b63147 to your computer and use it in GitHub Desktop.
code_snippet_7 for "Playing Mortal Kombat with TensorFlow.js. Transfer learning and data augmentation" translation
const video = document.getElementById('cam');
const Layer = 'global_average_pooling2d_1';
const mobilenetInfer = m => (p): tf.Tensor<tf.Rank> => m.infer(p, Layer);
const canvas = document.getElementById('canvas');
const scale = document.getElementById('crop');
const ImageSize = {
Width: 100,
Height: 56
};
navigator.mediaDevices
.getUserMedia({
video: true,
audio: false
})
.then(stream => {
video.srcObject = stream;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment