You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the image to be classified is not found, p5's loadImage function will fail and log an error in the console. The img variable will not contain a valid image.
When classifier.classify(img, gotResult); is called in the setup method it should trigger an error because the image is not valid. However, in the gotResult method, this code:
if(error){console.error(error);}
is not executed. The error you see logged in the console is from p5, not ml5. If I change the function to this:
// A function to run when we get any errors and the resultsfunctiongotResult(error,results){// Display error in the consoleif(error){console.error(error);console.log('error');createDiv('Error running image classifier. View JavaScript console for details.');}else{// The results are in an array ordered by confidence.console.log(results);console.log('no error');createDiv('Label: '+results[0].label);createDiv('Confidence: '+nf(results[0].confidence,0,2));}}
I see no error in the console.
Chromium Version 73.0.3683.103 (Official Build) Built on Ubuntu , running on Ubuntu 19.04 (64-bit) using ml5 0.3.0.
You can reproduce this by following the Getting Started tutorial but use an invalid image path.
The text was updated successfully, but these errors were encountered:
When I follow the example on the Hello ml5 page:
https://ml5-website-2.netlify.com/getting-started/hello-ml5/
If the image to be classified is not found, p5's
loadImage
function will fail and log an error in the console. Theimg
variable will not contain a valid image.When
classifier.classify(img, gotResult);
is called in thesetup
method it should trigger an error because the image is not valid. However, in thegotResult
method, this code:is not executed. The error you see logged in the console is from p5, not ml5. If I change the function to this:
I see
no error
in the console.Chromium Version 73.0.3683.103 (Official Build) Built on Ubuntu , running on Ubuntu 19.04 (64-bit) using ml5 0.3.0.
You can reproduce this by following the Getting Started tutorial but use an invalid image path.
The text was updated successfully, but these errors were encountered: