ml5js / ml5-library

Friendly machine learning for the web! 🤖
https://ml5js.org
Other
6.46k stars 899 forks source link

bodypix not working in p5js instance mode #852

Closed micuat closed 2 years ago

micuat commented 4 years ago

→ Step 1: Describe the issue 📝

bodypix returns error in p5js instance mode

→ Step 2: Screenshots or Relevant Documentation 🖼

→ Step 3: Share an example of the issue 🦄

https://editor.p5js.org/micuat/sketches/PYuow4Be3

error:

p5Utils.js:54 Uncaught (in promise) TypeError: e.p5Instance.loadImage is not a function
    at p5Utils.js:54
    at new Promise (<anonymous>)
    at new e (_export.js:36)
    at t.value (p5Utils.js:53)
    at t.<anonymous> (p5Utils.js:92)
    at x (runtime.js:62)
    at Generator._invoke (runtime.js:296)
    at Generator.t.<computed> [as next] (runtime.js:114)
    at i (asyncToGenerator.js:17)
    at asyncToGenerator.js:35
micuat commented 4 years ago

I didn't notice the example https://github.com/ml5js/ml5-examples/tree/development/p5js/BodyPix/BodyPix_p5Instance

is ml5.p5Utils.setP5Instance documented somewhere?

bomanimc commented 4 years ago

Adding the documentation label here to remind us to come back and add some documentation for this util.

beverlyhillz commented 4 years ago

I am looking forward to work on this issue.

dano1234 commented 3 years ago

Seems like Joey figured this out but it is not in the latest release?? https://github.com/ml5js/ml5-examples/issues/159

B3njimin commented 2 years ago

Hello! I just ran into the same problem while attempting to use charRNN in, instance mode. I am using... ml5.js version 0.6.0 chrome OS Windows 11

I tried using... ml5.p5Utils.setP5Instance(sketch); As seen in the BodyPix instance example but to no avail.

sketch.setup = () => { sketch.createCanvas(240, 240); ml5.p5Utils.setP5Instance(sketch); charRNN = ml5.charRNN('models/woolf', sketch.modelReady()); }

sketch.modelReady = () => { charRNN.reset(); // <-- calling reset throws the error cannot read property of undefined (readin 'reset') }

I hope this is of some help, all the best!

micuat commented 2 years ago

@B3njimin thanks for the report! I'm not tracking issue but if you can kindly open a separate issue it would be great because this issue is titled for bodypix not charRNN. And as the comment above, bodypix's issue seems fixed now so I'm closing this one.

B3njimin commented 2 years ago

Ok shall do thanks!

marcchicoine commented 2 years ago

Hi, I'm attempting bodypix parts via webcam with p5 integration. Works fine with general masking, but when trying to separate output into parts I keep getting this error. Thank you for the input!

Screenshot 2022-04-02 160627 @bomanimc ,