Last active
June 18, 2021 23:34
-
-
Save dalequark/c0e9c83e338508a96cc9c12d8d30daf5 to your computer and use it in GitHub Desktop.
Webcam object detection
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
<!-- Load TensorFlow.js. This is required to use coco-ssd model. --> | |
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"> </script> | |
<!-- Load the coco-ssd model. --> | |
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/coco-ssd"> </script> | |
<script> | |
// Grab DOM reference to video element. | |
const video = document.getElementById('webcamVideo'); | |
// Load the model. | |
cocoSsd.load().then(model => { | |
// detect objects in the image frame. | |
model.detect(video).then(predictions => { | |
console.log('Predictions: ', predictions); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment