I have trained a binary image classifier through inception3. I am able to evaluate the model immediately after creating it. But if I save the model and reload it and then try to evaluate or predict, then I am getting the following error:
FailedPreconditionError: Error while reading resource variable module_16/InceptionV3/Mixed_6d/Branch_2/Conv2d_0c_1x7/BatchNorm/beta from Container: localhost. This could mean that the variable was uninitialized. Not found: Resource localhost/module_16/InceptionV3/Mixed_6d/Branch_2/Conv2d_0c_1x7/BatchNorm/beta/N10tensorflow3VarE does not exist.
[[{{node lambda_2_8/module_16_apply_default/InceptionV3/InceptionV3/Mixed_6d/Branch_2/Conv2d_0c_1x7/BatchNorm/ReadVariableOp}}]]
Here is code snippet:
with tf.compat.v1.Session() as sess:
sess.run(tf.global_variables_initializer())
#sess.run(tf.local_variables_initializer())
new_model = tf.keras.models.load_model('mymodel.h5')
new_model.summary()
eval_model=new_model.evaluate(image_test, label_test)
eval_model
configuration:
tensorflow 1.14.0-rc1,
Keras 2.2.4-tf