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

Retrain image detection with MobileNet for use in TFjs, failure in tensorflowjs_converter #1576

Closed
serv-inc opened this issue May 9, 2019 · 4 comments
Assignees

Comments

@serv-inc
Copy link
Contributor

serv-inc commented May 9, 2019

TensorFlow.js version

'1.0.1'
(retrain.py did not work with tf-nightly-2.0, so that was run with '1.13.1 ('v1.13.1-0-g6612da8951')'. Installing tensorflowjs-converter then installed tf-nightly-2.0-preview-2.0.0.dev20190509)

Browser version

n.a.

Describe the problem or feature request

Both tutorials at https://www.tensorflow.org/hub/tutorials/image_retraining and
https://www.tensorflow.org/tutorials/images/hub_with_keras about retraining a model mention but do not describe conversion to mobile models. Yet, conversion using tensorflowjs_converter failed in every attempt. https://stackoverflow.com/questions/55849309/retrain-image-detection-with-mobilenet mentions two attempts by me as well as questions by others with the same problem.

Code to reproduce the bug / link to feature request

and github issues

@tafsiri
Copy link
Contributor

tafsiri commented May 9, 2019

cc @pyu10055

@pyu10055
Copy link
Collaborator

@serv-inc please check SO https://stackoverflow.com/questions/55849309/retrain-image-detection-with-mobilenet for answers.

@serv-inc
Copy link
Contributor Author

The resulting model failed to load with

'className' and 'config' must set.[sic]
at new ValueError (/tmp/node_modules/@tensorflow/tfjs-layers/dist/errors.js:68:28)
at Object.deserializeKerasObject (/tmp/node_modules/@tensorflow/tfjs-layers/dist/utils/generic_utils.js:241:19)
at Object.deserialize (/tmp/node_modules/@tensorflow/tfjs-layers/dist/layers/serialization.js:29:28)
at /tmp/node_modules/@tensorflow/tfjs-layers/dist/models.js:290:45
at step (/tmp/node_modules/@tensorflow/tfjs-layers/dist/models.js:54:23)
at Object.next (/tmp/node_modules/@tensorflow/tfjs-layers/dist/models.js:35:53)
at fulfilled (/tmp/node_modules/@tensorflow/tfjs-layers/dist/models.js:26:58)

when called as tf.loadLayersModel("file:///tmp/web_model/model.json")

@i-mochalov
Copy link

Hi @serv-inc
I encountered the same problem and it seems that we use the wrong method.
There are loadGraphModel for TF converted models and loadLayersModel for Keras ones

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

No branches or pull requests

5 participants