Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Refactor client model download into a separate module #7

Open
mncharity opened this issue Oct 10, 2018 · 3 comments
Open

Feature: Refactor client model download into a separate module #7

mncharity opened this issue Oct 10, 2018 · 3 comments

Comments

@mncharity
Copy link

Some time ago on linux, I found using a single webcam simultaneously from multiple processes added at least a frame of latency, which was problematic for VR/AR with slow webcams. If one is running other analyses in addition to posenet, that incentivizes combining them all into a single custom server, rather than using multiple turnkey servers. One can then also make application-specific performance tradeoffs and optimizations (like running posenet on only a part of the frame).

Thus I'm adding posenet to my existing server. But I'd still like it to work offline. So ideally, I'd like posenet-for-installations's model downloading functionality available as a separate module. Say a module which runs client/downloadModels.js upon install, and has client/src/models.ts as its entry point (but with BASE_URL refactored as an argument to loadModel). One user's story, FWIW.

Thank you for your work - it was quite helpful.

@oveddan
Copy link
Owner

oveddan commented Oct 10, 2018

Yes a standalone thing would be great. A lot of people would find it useful to just have an offline version of PoseNet. I believe this could be just part of the original tfjs-models repo, with the first step being allowing posenet to be loaded from a custom url:
tensorflow/tfjs#616

@oveddan
Copy link
Owner

oveddan commented Oct 10, 2018

@mncharity how would you imagine the integration of that standalone feature working in your project?

@mncharity
Copy link
Author

My quick-and-dirty approach was: a standalone module with a script "postinstall": "node downloadModels.js"; a project module build step which uses path.dirname(require.resolve('tfjs-models-weights-posenet-files'))+"/data" to find the download directory, and then links to it under the project's public/; and an import loadModel from tfjs-models-weights-posenet-files with a url argument added to loadModel(thelinkedurl, multiplier).

I was getting Error: socket hang up install failures until I added a large {timeout:10000} to https.get in downloadModels.js. Perhaps the download parallelism might be interacting poorly with yarn build system parallelism, creating problematic latencies? If so, it might be worth reducing the download parallelism?

I wondered whether posenet.CheckpointLoader accepts file: URLs, so this approach could be used with electron apps which aren't running a web server. But I haven't checked yet.

Instead of linking to the download directory, it might be more portable and robust to copy it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants