I use Python 2.7 and tensorflow 1.9 and keras 2.1.6 to train a model and outputted a .h5 weights file but then I want to save it as a ckpt which I will later on load and use for classification:
saver = tf.train.Saver(tracking_instance._net.trainable_collection)
model = keras.models.load_model("lenet_mnist.h5")
save_path = saver.save(sess, "/lenet_model_to_use.ckpt")
The model loads into the allocated variable but then crashes with the following error at saver.save()
:
tensorflow.python.framework.errors_impl.FailedPreconditionError: Attempting to use uninitialized value conv1/biases
I checked here and was recommended to use the following init:
sess = tf.Session()
init_op = tf.global_variables_initializer()
sess.run(init_op)
But still the same exception raises.
Any idea?