Loading the pre-trained model from the .h5 file (Works on Colab but does not work on Local)

28 Views Asked by At

Hello I'm struggling with loading pre-trained model for a while and cant solve this issue yet.

On Colab:

from google.colab import drive
drive.mount('/content/drive')
from keras.models import load_model
from keras.preprocessing import image
import numpy as np
model = load_model('/MyDrive/eye_detection/eyedetection.h5')

and model loaded succesfully.But when i try on Jupyter Notebook:
from keras.models import load_model
model = load_model('Desktop/test_set/eyedetection.h5')

I got an error:

TypeError: <class 'keras.src.layers.normalization.batch_normalization.BatchNormalization'> could not be deserialized properly. Please ensure that components that are Python object instances (layers, models, etc.) returned by `get_config()` are explicitly deserialized in the model's `from_config()` method.

countered: Error when deserializing class 'BatchNormalization' using config={'name': 'stem_bn', 'trainable': True, 'dtype': 'float32', 'axis': [3], 'momentum': 0.99, 'epsilon': 0.001, 'center': True, 'scale': True, 'beta_initializer': {'module': 'keras.initializers', 'class_name': 'Zeros', 'config': {}, 'registered_name': None}, 'gamma_initializer': {'module': 'keras.initializers', 'class_name': 'Ones', 'config': {}, 'registered_name': None}, 'moving_mean_initializer': {'module': 'keras.initializers', 'class_name': 'Zeros', 'config': {}, 'registered_name': None}, 'moving_variance_initializer': {'module': 'keras.initializers', 'class_name': 'Ones', 'config': {}, 'registered_name': None}, 'beta_regularizer': None, 'gamma_regularizer': None, 'beta_constraint': None, 'gamma_constraint': None}.`

Exception encountered: int() argument must be a string, a bytes-like object or a real number, not 'list'

enter image description here

enter image description here

I tried to load pre-trained model and could not loaded successfully.

0

There are 0 best solutions below