ml5-next-gen icon indicating copy to clipboard operation
ml5-next-gen copied to clipboard

imageClassifier not working in v1.0.1

Open aswyatt opened this issue 1 year ago • 3 comments

The image classifier does not seem to be working in v1.0.1 - it returns the same results regardless of the image. I followed the tutorial on the getting started page. If I change the model, I get a different result (but always the same result for a given model with different images). The image classifier is working fine in version 0.12.

aswyatt avatar Aug 02 '24 21:08 aswyatt

Hi @aswyatt, thank you for opening this issue!

Do you mind sharing your p5 sketch so we can narrow down the issue?

In the meantime, here is an example sketch for ImageClassifier that is working on my end: https://editor.p5js.org/ml5/sketches/pjPr6XmPY. Feel free to try it out and let me know whether it works for you!

ziyuan-linn avatar Aug 02 '24 22:08 ziyuan-linn

Sketch: https://editor.p5js.org/aswyatt/sketches/7XSXf4R0F

It's pretty much identical, and the problem appears to be the interaction with ML5 and Chrome, rather than the sketch. So if I run my sketch (or yours) on my phone (Android Chrome Beta 128.0.6613.14), they both worth fine, although I receive a warning "Initialization of backend webgpu failed ...", but it works. However, on my desktop in either Chrom (127.0.6533.89) or Edge (127.0.2651.74), it clearly does not classify the image for my script. I cannot run your script in Chrome - it says "TypeError: failed to fetch" when trying to load the image - there seems to be some kind of permissions issue. On Edge, yours runs but doesn't classify the image either (says its a spotlight).

aswyatt avatar Aug 02 '24 23:08 aswyatt

Hi @aswyatt! Sorry for the late reply. Were you able to solve the problem?

I tried your sketch in Chrome on both Windows 11 and macOS and everything works fine. It also works in Edge on Windows. I'm using the same Chrome version as you, but I can't reproduce the error.

ImageClassifier running in p5 web editor

If you haven't already, perhaps try clearing your browser cache?

The "TypeError: failed to fetch" error on my sketch may be related to a p5 Web Editor CORS issue: https://github.com/processing/p5.js-web-editor/issues/3156

ziyuan-linn avatar Aug 06 '24 20:08 ziyuan-linn

I also cannot reproduce the issue with the latest release and it's been a year so closing! Happy to revisit of course if anyone finds the same bug!

shiffman avatar Jul 30 '25 02:07 shiffman