DEC-Keras
DEC-Keras copied to clipboard
Getting a 'initial_value must be specified' ValueError
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?
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
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