Open ahoquegh opened 6 years ago
This model has no graph embedded in it. .h5 is a generic format, and in the world of Keras it can be used to store both full models as well as weights alone. In this case, your .h5 has only weights and no graph/model definition. To store a full model based on these weights, you can do this:
First install an old version of keras:
pip install keras==2.0.4 # this appears to be a model compatible with this code
here is a modified script that will generate a complete model:
https://gist.github.com/sleepsonthefloor/f527470b0a38c0f6b2f3aa8908503923
If you run that script, it should yield a file called whole_inception_model.h5
And now you should be able to create your .pb:
docker run -v $PWD:/tmp/ sleepsonthefloor/graphpipe-h5topb:latest whole_inception_model.h5 whole_inception_model.pb
Hello, convert.py script failed while I was trying to convert the imagenet trained inceptionV3 model ( downloaded from https://github.com/fchollet/deep-learning-models/releases/download/v0.5/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5 Appreciate if you could suggestion solution or workaround Thanks
Here is the error captured from o/p: $ ./convert.py inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5 inception_v3_weights_tf_dim_ordering_tf_kernels_notop.pb 2018-09-13 17:55:32.889998: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 2018-09-13 17:55:32.892157: I tensorflow/core/common_runtime/process_util.cc:69] Creating new thread pool with default inter op setting: 2. Tune using inter_op_parallelism_threads for best performance. Traceback (most recent call last): File "convert.py", line 59, in
h5_to_pb(sys.argv[1], sys.argv[2])
File "convert.py", line 40, in h5_to_pb
write_graph(constantize(h5), pb)
File "convert.py", line 25, in constantize
mod = models.load_model(fname)
File "/home/ahoque/anaconda2/envs/tfk/lib/python3.6/site-packages/tensorflow/python/keras/engine/saving.py", line 227, in load_model
raise ValueError('No model found in config file.')
ValueError: No model found in config file.