Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Feature Extractor Examples" from ml5.js website / TypeError: Failed to fetch #1483

Open
hedlerhdm opened this issue Apr 9, 2024 · 13 comments

Comments

@hedlerhdm
Copy link

p5.js version

1.9.1

What is your operating system?

Windows 11

Web browser and version

Chrome 123.0.6312.106

Actual Behavior

the FeatureExtractor Examples for the "p5 web editor" from the ml5.js website raise an error: TypeError: Failed to fetch.

Here are the Examples:
FeatureExtractor_Image_Regression
FeatureExtractor_Image_Classification

image

a couple of days ago, the examples worked perfecty fine.

@davepagurek
Copy link

This is the error in the console for me:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.kaggle.com/models/google/mobilenet-v1/frameworks/tfJs/variations/025-224-classification/versions/1/model.json?tfjs-format=file&tfhub-redirect=true. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 302.

Looks like Kaggle recently made some API changes on April 8, so maybe it's related to that?

@hedlerhdm
Copy link
Author

Besides the "Feature Extractor Examples", other sample codes are also affected: FaceMesh, Hand Pose, Image Classification, etc.

@jht9629-nyu
Copy link

I see cross-origin error on these two p5js sketches.
They worked fine a few weeks ago.

https://editor.p5js.org/ml5/sketches/Facemesh_Webcam

https://editor.p5js.org/ml5/sketches/Handpose_Webcam

Access to fetch at 'https://www.kaggle.com/models/mediapipe/facemesh/frameworks/tfJs/variations/default/versions/1/model.json?tfjs-format=file&tfhub-redirect=true'
(redirected from 'https://tfhub.dev/mediapipe/tfjs-model/facemesh/1/default/1/model.json?tfjs-format=file')
from origin 'https://preview.p5js.org' has been blocked by CORS policy:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
If an opaque response serves your needs,
set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

@shiffman
Copy link
Member

Hi everyone! We are working on a new version of the ml5.js with more up-to-date models, the release is coming very soon! Please see the following for newer examples that you can use right now in the meantime!

New examples: https://editor.p5js.org/ml5/collections/pUzWMkdmE
New library: https://unpkg.com/[email protected]/dist/ml5.min.js
Temporary documentation: https://github.com/ml5js/ml5-next-gen/blob/main/documentation.md

Please file any issues in this repo: https://github.com/ml5js/ml5-next-gen

@hedlerhdm
Copy link
Author

Thanks, Daniel! Your work is highly appreciated.
Any chance to fix the problem anyway? I'm using ml5.js during ongoing lectures. Almost all examples are affected (e.g., feature extraction).

@shiffman
Copy link
Member

Was this perhaps a temporary issue yesterday? Everything seems to be working for me, I tested the ones above as well as these three examples from my videos.

https://editor.p5js.org/codingtrain/sketches/qFZF7iDe
https://editor.p5js.org/codingtrain/sketches/5A_TJHA1
https://editor.p5js.org/codingtrain/sketches/ULA97pJXR

@jht9629-nyu
Copy link

@hedlerhdm
Copy link
Author

all examples are now working again. Maybe a temporary problem with Kaggle.
Thanks anyway

@devihall
Copy link

Hey there! I can confirm this was a TensorFlow issue. I had raised this issue on their Github and they rolled out a fix. . They also provided some recommendations for how to avoid this in the future. See link attached.

tensorflow/hub#904 (comment)

@jht9629-nyu
Copy link

Similar failure today:

https://docs.ml5js.org/#/reference/bodypose
Access to fetch at 'https://www.kaggle.com/models/google/movenet/tfJs/multipose-lightning/1/model.json?tfjs-format=file&tfhub-redirect=true' (redirected from 'https://tfhub.dev/google/tfjs-model/movenet/multipose/lightning/1/model.json?tfjs-format=file') from origin 'https://docs.ml5js.org' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

https://docs.ml5js.org/#/reference/facemesh
Access to fetch at 'https://www.kaggle.com/models/mediapipe/face-landmarks-detection/tfJs/face-mesh/1/model.json?tfjs-format=file&tfhub-redirect=true' (redirected from 'https://tfhub.dev/mediapipe/tfjs-model/face_landmarks_detection/face_mesh/1/model.json?tfjs-format=file') from origin 'https://docs.ml5js.org' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

@shiffman
Copy link
Member

I just checked and it's working for me right now? Did it resolve for you @jht9629-nyu?

I think, unfortunately, we are at the mercy of the google/kaggle/tfhub servers and if something is down, then loading the model in ml5.js breaks. Maybe it would be good to document this better and/or have a back-up solution?

Feel free to file an issue in ml5-next-gen, that's where we are tracking ongoing development now!

https://github.com/ml5js/ml5-next-gen/

@jht9629-nyu
Copy link

Working for me now. Appears to be a temporary problem.

https://docs.ml5js.org/#/reference/bodypose
https://docs.ml5js.org/#/reference/facemesh

@jht9629-nyu
Copy link

jht9629-nyu commented Aug 14, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants