Loading a model offline (PoseNet)

2,162 views
Skip to first unread message

Dan Oved

unread,
Jul 29, 2018, 9:24:56 PM7/29/18
to TensorFlow.js Discussion
I want to be able to use PoseNet totally offline - in a location that it won't have internet access.  Is there a way to have it load from a model with a path in the local file system, assuming that model has already been downloaded to that path?

Nikhil Thorat

unread,
Jul 29, 2018, 10:18:16 PM7/29/18
to Dan Oved, TensorFlow.js Discussion
You could run a python SimpleHTTP server from the directory and just use a normal tf.loadModel / tf.loadFrozenModel call with a relative URL. Alternatively, you could save the model to IndexDB / LocalStorage and load it from that from offline.

On Sun, Jul 29, 2018 at 9:24 PM Dan Oved <ove...@gmail.com> wrote:
I want to be able to use PoseNet totally offline - in a location that it won't have internet access.  Is there a way to have it load from a model with a path in the local file system, assuming that model has already been downloaded to that path?

--
You received this message because you are subscribed to the Google Groups "TensorFlow.js Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+uns...@tensorflow.org.
Visit this group at https://groups.google.com/a/tensorflow.org/group/tfjs/.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfjs/b76fe3db-2822-47a2-ae95-9776a56f6dd5%40tensorflow.org.

John Terry

unread,
Sep 26, 2018, 3:56:40 PM9/26/18
to TensorFlow.js Discussion
I am curious on how you go about downloading posenet learned weights. I am also interested in doing something offline. 

Dan Oved

unread,
Oct 2, 2018, 1:37:25 PM10/2/18
to TensorFlow.js Discussion
John,

I made a version of the PoseNet camera demo that downloads all the models so they can be served offline.

Check out the repo here:

Here is the script I use to download the models:

and here is code I used to load from a different url:

Ralf S.

unread,
Nov 22, 2018, 6:07:50 AM11/22/18
to TensorFlow.js Discussion
Dan, your project is really helpful, thanks.

Unfortunately, I'm a bit unsure about the terms for using the models. If I understand correctly, they're downloaded automatically from Google and used "as black boxes" for inference. Is the code for creating and training the models available somewhere? Would it be possible for me to modify them, or even run them on Keras or TensorFlow?

Godwin Pauldurai

unread,
Jan 22, 2019, 4:19:39 AM1/22/19
to TensorFlow.js Discussion
Hi Dan,
       Is it possible to measure the length between two shoulder points in centimeters, please provide some tips which could help me,
Thank you.

Regards 
Godwin 
Message has been deleted

Krzysztof Z.

unread,
Apr 27, 2020, 1:03:19 PM4/27/20
to TensorFlow.js Discussion
hello, the download models script. throws an error


incorrect header check
    at Zlib.zlibOnError [as onerror] (zlib.js:180:17)
Emitted 'error' event on Gunzip instance at:
    at errorOrDestroy (internal/streams/destroy.js:108:12)
    at Gunzip.onerror (_stream_readable.js:729:7)
    at Gunzip.emit (events.js:310:20)
    at Zlib.zlibOnError [as onerror] (zlib.js:183:8) {
  errno: -3,
  code: 'Z_DATA_ERROR'
}


would you know what causes it? im not strong in javascript but i need the models :(

Jason Mayes

unread,
Apr 27, 2020, 3:00:39 PM4/27/20
to TensorFlow.js Discussion
Check my video where I do real time clothing sizing estimations in TensorFlow.js. You just need a reference eg the user's height. From that all else can be calculated on ever frame: https://www.youtube.com/watch?v=kFtIddNLcuM

Jason
Reply all
Reply to author
Forward
0 new messages