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

bodyPose and bodySegmentation failing to preload in p5 instance mode #175

Open
jackbdu opened this issue Jul 22, 2024 · 3 comments
Open

Comments

@jackbdu
Copy link

jackbdu commented Jul 22, 2024

Creating a new issue to track the progress of this:

@lindapaiste Thank you for adding support for instance mode. I was able to preload most models (ml5.faceMesh, ml5.handPose, ml5.imageClassifier, ml5.neuralNetwork, and ml5.sentiment) but I'm getting an error for ml5.bodyPose. See this minimal sketch demonstrating the issue. I also included my temporary fix in the comments, which creates blank window._incrementPreload() and window._decrementPreload() to avoid this error.

I'm also getting an error for preloading ml5.bodySegmentation in instance mode, and that could be fixed by declaring a global variable let video;.

Originally posted by @jackbdu in #81 (comment)

@lindapaiste
Copy link
Contributor

We need to remove this call:

if (this.p5PreLoadExists()) window._incrementPreload();

(and any others like it)

There will be no window._incrementPreload when using instance mode because _incrementPreload will be a property of the p5 instance, rather than a property of the window.

@lindapaiste
Copy link
Contributor

I'm also getting an error for preloading ml5.bodySegmentation in instance mode, and that could be fixed by declaring a global variable let video;.

Likely we have some code that is using an improperly scoped video variable. We definitely should not have a global/window scoped video variable anywhere. I suspect it's an issue where we are using this.video in a context where this is actually the window. That sort of thing can be fixed by binding the function to the correct this context. I would need to dig into the code to find where the bad variable is.

@lindapaiste
Copy link
Contributor

We're using a variable video that doesn't exist on like 34 of BodySegmentation.

this.video = video;

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

2 participants