fferroni / DEC-Keras

Deep Embedding Clustering in Keras
GNU General Public License v3.0
129 stars 59 forks source link

Getting a 'initial_value must be specified' ValueError #6

Open bfan1256 opened 6 years ago

bfan1256 commented 6 years ago

Trying to load model for production predictions with the code:

from keras_dec import ClusteringLayer
from keras.models import load_model
model = load_model('./DEC.model', custom_objects={'ClusteringLayer': ClusteringLayer})
...

This is not working and producing: ValueError: initial_value must be specified. This error is referring to line #64 in keras_dec.py What is the issue?

mathiaskloth commented 6 years ago

I am trying to load one of the saved intermediate files (line #326 in keras_dec.py) with the code

from keras_dec import ClusteringLayer
from keras.models import load_model
model = load_model('DEC_model_437500.h5', custom_objects={'ClusteringLayer':ClusteringLayer})

This produce the same value error. ValueError: initial_value must be specified.

How are the saved intermediate models supposed to be loaded?

Best Regards, Mathias

digivi13 commented 5 years ago

I got the same error, solved it by adding weights to the base config like so: base_config['weights'] = self.initial_weights When training I save the model to a json file and save the weights separately. Load the json model and then the weights and everything works perfectly