ml5-data-and-models-server icon indicating copy to clipboard operation
ml5-data-and-models-server copied to clipboard

Is it posible to load posenet?

Open Warholik opened this issue 5 years ago • 10 comments

Hello!

I used posenet this way:

Is it possible to use it in the same way with your repo offline? If yes how?

Thanks!

Warholik avatar Nov 09 '19 22:11 Warholik

Hi!

Yes in v0.4.2 it is possible, however it requires a few steps:

  1. Clone this repo: https://github.com/ml5js/ml5-data-and-models-server. Follow the instructions here: https://github.com/ml5js/ml5-data-and-models-server#setup-
  2. In ml5, you'll make sure:
<script src="https://unpkg.com/[email protected]/dist/ml5.min.js"></script>

and in your sketch.js

posenet = ml5.poseNet("http://localhost:5000/posenet", video)

I haven't gotten around to documenting this or making a tutorial, but give this a try and let me know if this works! Thanks!

joeyklee avatar Nov 11 '19 14:11 joeyklee

Thanks @joeyklee for this awesome work; Unfortunately I get 404 error, trying to load posenet. I use both http://localhost:5000/posenet and http://localhost:5000/posenet/mobilenet_v1_050/, Still it doesn't work.

reza7rm avatar Mar 24 '20 18:03 reza7rm

same here. I also tried making the path part of the options. like so

let poseOptions = {
    modelUrl: "http://localhost:5000/posenet",
  detectionType: 'single'
};
poseNet = ml5.poseNet(video, poseOptions, modelReady);

I guess I am also a bit unclear about the location of where ml5-data-and-models-server-source needs go in reference to my project folder. right now I have: +--myProject | +--index.html | +--script.js | +--ml5-data-and-models-server-source

I cd to ml5-data-and-models-server-source and call npn run serve

I should also mention that I used the Brackets IDE, which opens a live browser view at http://127.0.0.1:61583/index.html

stephanschulz avatar May 21 '20 16:05 stephanschulz

Anybody got this working? I need to run PoseNet offline for an upcoming installation, so very interested in case someone figured this out :-)

AndreasRef avatar Jun 23 '20 13:06 AndreasRef

yes I got it running locally.

added this to index.html

  <script src="/libs/p5js/p5-0.9.0/p5.min.js"></script>
        <script src="/libs/p5js/p5-0.9.0/addons/p5.dom.min.js"></script>

        <script src="http://localhost:5000/ml5.min.js" type="text/javascript"></script>

before running my JS project that uses ml5js I did:

  • in the terminal cd to your ml5-data-and-models-server folder
  • then type npm install and hit enter. but only for the first time you do this
  • then npm run download:all or if you do not want to wait long for it to download all model you could specify npm run download:posenet and maybe other models like npm run download:posenet2 (see the readme in the ml5-data-and-models-server folder)
  • then type npm run serve and hit enter

stephanschulz avatar Jun 23 '20 13:06 stephanschulz

Thanks @stephanschulz ! I followed the steps and seem to have downloaded the models + run them via npm, but it returns a 404:

GET http://localhost:5000/ml5.min.js net::ERR_ABORTED 404 (Not Found) sketch.js:21 Uncaught ReferenceError: ml5 is not defined at setup (sketch.js:21)

Any chance I could see your posenet code (html + js), to learn what I did wrong?

AndreasRef avatar Jun 23 '20 14:06 AndreasRef

maybe the local server that ml5-data-and-models-server starts has a different Port and is not 5000. the terminal should show you what port it uses when you start the npm run thing.

I will put together a simple example in a bit and post it here.

stephanschulz avatar Jun 23 '20 14:06 stephanschulz

  • here is a video of me starting the server and my example running using potent. https://www.dropbox.com/sh/z5n1udzvh5pb6m6/AAA6rbx7ke7LKyluHExQ2C8Ra?dl=0
  • also included a screenshot show the included files and models needed.
  • also find my PoseNet_webcam example

stephanschulz avatar Jun 23 '20 15:06 stephanschulz

Wow, thank you so much @stephanschulz ! I got it working thanks to your guidance and example 🥳. Really appreciate all your help.

AndreasRef avatar Jun 24 '20 09:06 AndreasRef

I have the same issue, I did exactly same(run the server and using bracket) I even couldn't find the ml5.min.js in the folder so tried to download it from the CDN and put it into the folder but still no luck... Any clues or solutions? Thank you

viswongdev avatar Aug 25 '21 23:08 viswongdev