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
ISSUE : Sequential model 'sequential_1' has already been configured to use input shape (None, 224, 224, 3). You cannot build it with input_shape [None, 224, 224, 3]
#20214
Closed
thayyilakul opened this issue
Sep 5, 2024
· 7 comments
Currently learning tensorflow with keras and got this error while loading saved model which is saved in keras extension. ValueError: Sequential model 'sequential_1' has already been configured to use input shape (None, 224, 224, 3). You cannot build it with input_shape [None, 224, 224, 3]
# Create a function to load a trained model
def load_model(model_path):
'''
Loads a saved model from a specified path
'''
print(f'Loading saved model from: {model_path}')
# Enable unsafe deserialization
# tf.keras.config.enable_unsafe_deserialization()
# model = tf.keras.models.load_model(model_path,
# custom_objects = {'KerasLayer' : hub.KerasLayer})
model = tf.keras.models.load_model(model_path)
return model
Below is how i am calling load function loaded_1000_image_model = load_model('filename.keras')
The text was updated successfully, but these errors were encountered:
Thanks for reporting this issue. Can you please let me know exactly at which line you are getting error ? I am not able to get error while running this function(create_model()). Attached gist for the reference.
Currently learning tensorflow with keras and got this error while loading saved model which is saved in keras extension.
ValueError: Sequential model 'sequential_1' has already been configured to use input shape (None, 224, 224, 3). You cannot build it with input_shape [None, 224, 224, 3]
Below is my model creation function
MODEL_URL is just a kaggle dataset mobilenet-v2
Below is my load model function
Below is how i am calling load function
loaded_1000_image_model = load_model('filename.keras')
The text was updated successfully, but these errors were encountered: