You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am able to save the keras model (nn4.small2.v1.h5) using the command model.save('new_model.h5'). But when I tried to load the model back, I am getting error, the complete details are given below.
nn4_small2_pretrained = create_model()
nn4_small2_pretrained.load_weights('weights/nn4.small2.v1.h5')
nn4_small2_pretrained.save("new_model.h5")
del nn4_small2_pretrained
from keras.models import load_model as lm
model = lm("new_model.h5")
Traceback (most recent call last):
File "<ipython-input-8-74cf4e3a50de>", line 1, in <module>
model = lm("waste.h5")
File "/data/repos/tfenv/lib/python3.6/site-packages/keras/models.py", line 270, in load_model
model = model_from_config(model_config, custom_objects=custom_objects)
File "/data/repos/tfenv/lib/python3.6/site-packages/keras/models.py", line 347, in model_from_config
return layer_module.deserialize(config, custom_objects=custom_objects)
File "/data/repos/tfenv/lib/python3.6/site-packages/keras/layers/__init__.py", line 55, in deserialize
printable_module_name='layer')
File "/data/repos/tfenv/lib/python3.6/site-packages/keras/utils/generic_utils.py", line 144, in deserialize_keras_object
list(custom_objects.items())))
File "/data/repos/tfenv/lib/python3.6/site-packages/keras/engine/topology.py", line 2535, in from_config
process_node(layer, node_data)
File "/data/repos/tfenv/lib/python3.6/site-packages/keras/engine/topology.py", line 2492, in process_node
layer(input_tensors[0], **kwargs)
File "/data/repos/tfenv/lib/python3.6/site-packages/keras/engine/topology.py", line 619, in __call__
output = self.call(inputs, **kwargs)
File "/data/repos/tfenv/lib/python3.6/site-packages/keras/layers/core.py", line 685, in call
return self.function(inputs, **arguments)
File "/data/Work/workspace/person_recognition/python/face-recognition/utils.py", line 36, in LRN2D
return tf.nn.lrn(x, alpha=1e-4, beta=0.75)
NameError: name 'tf' is not defined
How can I load a model without error
The text was updated successfully, but these errors were encountered:
I am able to save the keras model (nn4.small2.v1.h5) using the command
model.save('new_model.h5')
. But when I tried to load the model back, I am getting error, the complete details are given below.How can I load a model without error
The text was updated successfully, but these errors were encountered: