Open hardikyjoshi opened 4 years ago
@shiffman and team, do you have a sense of what might have changed?
I just tested with the latest ml5 and a newly trained model and it worked for me (no p5). Do you see anything different between yours and mine? Feel free to file an issue at https://github.com/ml5js/ml5-library
https://editor.p5js.org/codingtrain/sketches/ZTQ533aG0
// Grab elements, create settings, etc.
const video = document.getElementById('video');
// Create a webcam capture
navigator.mediaDevices.getUserMedia({ video: true })
.then((stream) => {
video.srcObject = stream;
video.play();
})
ml5.imageClassifier('https://teachablemachine.withgoogle.com/models/furopyvSe/model.json', video)
.then(classifier => loop(classifier))
const loop = (classifier) => {
classifier.classify()
.then(results => {
result.innerText = results[0].label;
probability.innerText = results[0].confidence.toFixed(4);
loop(classifier) // Call again to create a loop
})
}
When I try to manually classify a video using ml5's imageClassifier and Google Teachable Machine using vanilla javascript (not the p5.js). When I give it a model from the Google Teachable machine I get this error in console:
I've used the latest version of ml5, 1.2.9 of tf.min.js and 0.8 for teachablemachine-image.min.js.
JSFiddle Link: https://jsfiddle.net/hardikj/e4kL5njs/