Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unknown initializer: GlorotUniform when loading Keras model

I trained my CNN (VGG) through google colab and generated .h5 file. Now problem is, I can predict my output successfully through google colab but when i download that .h5 trained model file and try to predict output on my laptop, I am getting error when loading the model.

Here is the code:

import tensorflow as tf from tensorflow import keras import h5py  # Initialization  loaded_model = keras.models.load_model('./train_personCount_model.h5') 

And the error:

ValueError: Unknown initializer: GlorotUniform 
like image 717
Dhruvin modi Avatar asked Nov 07 '18 05:11

Dhruvin modi


1 Answers

I ran into the same issue. After changing:

from tensorflow import keras

to:

import keras

life is once again worth living.

like image 143
lintex Avatar answered Sep 20 '22 14:09

lintex