oveddan / posenet-for-installations

Provides an ideal way to use PoseNet for installations; it works offline and broadcasts poses over websocket.
Apache License 2.0
132 stars 29 forks source link

yarn download-models fails #16

Closed b005t3r closed 5 years ago

b005t3r commented 5 years ago
> node downloadModels.js

downloading file at https://storage.googleapis.com/tfjs-models/weights/posenet/mobilenet_v1_101/manifest.json
downloading file at https://storage.googleapis.com/tfjs-models/weights/posenet/mobilenet_v1_100/manifest.json
downloading file at https://storage.googleapis.com/tfjs-models/weights/posenet/mobilenet_v1_075/manifest.json
downloading file at https://storage.googleapis.com/tfjs-models/weights/posenet/mobilenet_v1_050/manifest.json
(node:53899) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token  in JSON at position 0
    at JSON.parse (<anonymous>)
    at loadAndSaveManifest (/Users/booster/Documents/JS/posenet-for-installations/client/downloadModels.js:48:25)
    at async downloadCheckpoint (/Users/booster/Documents/JS/posenet-for-installations/client/downloadModels.js:79:20)
    at async downloadCheckpointFromSubfolder (/Users/booster/Documents/JS/posenet-for-installations/client/downloadModels.js:93:3)
    at async Promise.all (index 3)
oveddan commented 5 years ago

I can confirm this issue. Stand by for the posenet 2.0 upgrade.

oveddan commented 5 years ago

Has to do with the model files now being gzipped: https://github.com/tensorflow/tfjs/issues/1712

b005t3r commented 5 years ago

Thanks, but is there a solution? :)

oveddan commented 5 years ago

@b005t3r this is now fixed.

b005t3r commented 5 years ago

Thanks! I managed to download all 4 models, however it didn't work the first time I tried it for some reason.

I see the models are actually in some strange format - any idea how can I convert those to pb format, that I can use with TF for Java?

oveddan commented 5 years ago

These are the legacy format of tf.js, and posenet 2.0 uses the frozen graph format. That being said, check out https://github.com/rwightman/posenet-python in which these weights are downloaded and converted into a python model.