1

I am trying to get a webgl app from this github repo: https://github.com/terryky/tfjs_webgl_app working, but I am running into some issues. I would like to use the full-body blazepose model.

I cloned the repo, and just clicked index.html. Firefox shows me a dialog that says: "failed to load model", which is coming from this piece of code in tfjs_blazepose.js:

init_tfjs_blazepose ()
{
    try {
        let url = "./model/tfjs_model_full_pose_detection_float32/model.json";
        s_detect_model = await tf.loadGraphModel(url);

        let url_landmark = "./model/tfjs_model_full_pose_landmark_39kp_float32/model.json";
        s_landmark_model = await tf.loadGraphModel(url_landmark);
    }
    catch (e) {
        alert ("failed to load model");
        alert (e.message)
    }

(index.html calls startWebGL(); in webgl_main.js, which in turn contains the line await init_tfjs_blazepose)

After that message, Firefox presents me with another window containing the error message: "NetworkError when attempting to fetch resource." Looking at other people experiencing this error, I have not yet been able to find the similarities.

My assumption is that something is going wrong with the tf.loadGraphModel function, resulting in this error message, but I am not sure where to look for the problem.

I am running Ubuntu 18.04. I am experiencing some problems with the npm install command right now, so I do not have tfjs installed. From looking here (https://www.tensorflow.org/js/tutorials/setup) however, I assumed this would not be necessary, since these lines are included in the index.html file:

    <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"></script>
    <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-core"></script>
    <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-converter"></script>
    <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm/dist/tf-backend-wasm.js"></script>

I have close to zero experience with js in general, so I have the feeling I am just missing some dependencies or something of that nature which might be obvious to you. Any advice would be much appreciated.

gman
  • 100,619
  • 31
  • 269
  • 393
Henk
  • 11
  • 2
  • try running it from [a server](https://stackoverflow.com/questions/12905426/what-is-a-faster-alternative-to-pythons-http-server-or-simplehttpserver) – gman Nov 28 '20 at 01:27
  • @gman Thanks for the response! I am wondering, would this work, since I am not running this using NodeJS? I feel like this code is supposed to run just in my web browser – Henk Nov 28 '20 at 13:48
  • You can't fetch files in the browser from your hard drive which is what `tf.loadGraphModel` is trying to do. – gman Nov 28 '20 at 16:52
  • You can add the files to the website's static resources though, which would allow you to load the model directly from browser – Andy K Nov 29 '20 at 08:19

0 Answers0