Created
June 21, 2020 16:03
-
-
Save risenW/31f4cc51131149d458a4e7d63d5b9b4a to your computer and use it in GitHub Desktop.
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
let base_net,webcam; | |
const webcamElement = document.getElementById('webcam'); | |
const classifier = knnClassifier.create(); | |
async function addExample(classId) { | |
// Capture an image from the web camera. | |
const img = await webcam.capture(); | |
// Get the intermediate activation of MobileNet | |
const activation = base_net.infer(img, true); | |
// Pass the intermediate activation to the classifier. | |
classifier.addExample(activation, classId); | |
// Dispose the tensor to release the memory. | |
img.dispose(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment