LingDong- / handpose-facemesh-demos

🎥🤟 8 minimalistic templates for tfjs mediapipe handpose and facemesh
https://handpose-demos.glitch.me/
187 stars 33 forks source link

run offline with local server #5

Open stephanschulz opened 3 years ago

stephanschulz commented 3 years ago

Hey Lingdong. Thanks for making this code available.

I am trying to make it run in offline mode using the Brackets.io IDE to work on it. Do you have instruction on how to run this locally?

For now I tried copying its linked tensor flow scripts to a local folder

        <script src="libs/tensorflow/tfjs-core-1.7.4/dist/tf-core.min.js"></script>
        <script src="libs/tensorflow/tfjs-converter-1.7.4/dist/tf-converter.min.js"></script>
        <script src="libs/tensorflow/tensorflow-models/handpose-0.0.4/dist/handpose.min.js"></script>
Screen Shot 2020-12-03 at 9 17 01 AM

But get the following error:

Screen Shot 2020-12-03 at 9 14 46 AM

I guess I will try to run a npm server next and see if that somehow work.

stephanschulz commented 3 years ago

looking in to libs/tensorflow/tensorflow-models/handpose-0.0.4/dist/index.js that the model and anchors get loaded from an external file. So i guess there is no way to load a local model, unless i modify the distribution ?

 const HANDDETECT_MODEL_PATH = 'https://tfhub.dev/mediapipe/tfjs-model/handdetector/1/default/1';
    return tfconv.loadGraphModel(HANDDETECT_MODEL_PATH, { fromTFHub: true });
LingDong- commented 3 years ago

Hi @stephanschulz ,

Sorry for the late reply, been really busy lately, hope this is still helpful:

It is possible to run this offline, by downloading the entire model in a folder structure.

For example: https://glitch.com/edit/#!/networked-hand-3js-tf174-handv1

where the models are downloaded to the /public/frozen/models/ folder.

Simply change the path to point to the local link, and it should then work.