Reputation: 59
My app can't connect Internet all the time, and how to load trained bodypix from local disk? The nodejs code snippet
const net = await bodyPix.load({
architecture: 'MobileNetV1',
outputStride: 16,
multiplier: 0.75,
quantBytes: 2,
});
In README.md I found
modelUrl - An optional string that specifies custom url of the model. This is useful for local development or countries that don't have access > to the models hosted on GCP.
Could you please give me an example what the url is of the local model? and what's the content of the dest model (BTW: how can I download the trained model?). Thanks very much!
Upvotes: 0
Views: 913
Reputation: 522
To load a bodypix model locally you need to download, and host the model's json
, and .bin
files then access them using the modelUrl
option.
Eg:
const net = await bodyPix.load({
architecture: 'MobileNetV1',
outputStride: 16,
multiplier: 0.75,
quantBytes: 2,
modelUrl: "/public/model-stride16.json"
});
The url passed to modelUrl
must be a valid url.
Upvotes: 1
Reputation: 301
You should look into Progressive Web Apps if you want to be able to use JavaScript offline like an App.
https://www.smashingmagazine.com/2016/08/a-beginners-guide-to-progressive-web-apps/
https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Offline_Service_workers
Upvotes: 0