Created
November 14, 2018 21:06
-
-
Save Marina-Miranovich/fd9e0cd349a37c56c8effa517adc4643 to your computer and use it in GitHub Desktop.
code_snippet_13 for "Playing Mortal Kombat with TensorFlow.js. Transfer learning and data augmentation" translation
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
const [punch, kick, nothing] = Array.from((model.predict( | |
mobilenet(tf.fromPixels(scaled)) | |
) as tf.Tensor1D).dataSync() as Float32Array); | |
const detect = (window as any).Detect; | |
if (nothing >= 0.4) return; | |
if (kick > punch && kick >= 0.35) { | |
detect.onKick(); | |
return; | |
} | |
if (punch > kick && punch >= 0.35) detect.onPunch(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment