ml5js / ml5-library

Friendly machine learning for the web! πŸ€–
https://ml5js.org
Other
6.38k stars 906 forks source link

FAILED TO LOAD COLOR CLASSIFIER MODEL #1446

Closed JALEXCORZA closed 11 months ago

JALEXCORZA commented 1 year ago

Dear ml5 community,

I am trying to recreate the color classifier project from : https://editor.p5js.org/ml5/sketches/O2p3aRXAc_ but in a react project and have this error image

image

this is my project repository : https://github.com/JALEXCORZA/colorclassifierreact.git

THANK YOU! MERCI! ABRIGADO! GRACIAS! DANKE! 🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈 ---------------------------------------------->

sproutleaf commented 11 months ago

Hi Joseph,

Thank you for opening this issue with us and we apologize for taking a while to get back to you! Both of the links in the issue are no longer valid. If you still have this problem, would you mind including more updated links in the reply? Thank you!

Miaoye

lindapaiste commented 11 months ago

I'm working backwards to the most likely cause of the error.

The lines that trigger the error are this: https://github.com/ml5js/ml5-library/blob/f80f95aa6b31191ab7e79ff466e8506f5e48a172/src/NeuralNetwork/NeuralNetworkData.js#L590-L593

The error is because your dataUrl is not a string. I don't know what it is -- it's the data variable in your code.

let nnOptions = {
   dataUrl: data // <-- this right here

You can add a console.log(data) to see what the variable actually is.

But it looks like you already figured it out and got it working using the .addData() method rather than loading the data from a file URL.