Reputation: 6612
I want to convert rcmalli_vggface_tf_vgg16.h5 pre-trained model to js format to use in a tensorflow-js project.
to convert this file I tried different ways but yet I could not to solve the problem.
I'm using converters.convert_tf_saved_model
method to load and then convert it to a json file.
converters.convert_tf_saved_model('rcmalli_vggface_tf_vgg16.h5','web_model')
But every time following error is shown:
SavedModel file does not exist at: rcmalli_vggface_tf_vgg16.h5
While I am sure the h5 file is next to the file that is running the program.
I try full path address but same error occured. I do not know what is problem
Upvotes: 1
Views: 52
Reputation:
You are converting a keras saved_model but the model is a keras layers_model because it is stored in h5 file.
I find this way the simplest to convert the model. And it did it in about 2 seconds.
tensorflowjs_converter --input_format=keras rcmalli_vggface_tf_vgg16.h5 ./converted
tf.loadLayers
API.const model = await tf.loadGraphModel('path/to/model.json');
Note*: ./converted
is the output directory, be sure not to overwrite your own stuff.
Upvotes: 1