In Keras there are several ways to save a model. You can store the whole model(model definition, weights and training configuration) as HDF5 file, just themodel configuration (as JSON or YAML file) or just the weights (as HDF5 file).Here’s how you do each:
with open("model_config.json", "w") as f:
Loading your Keras model
Let’s start with the recommended way, loading the full model back into DL4J (we assume it’son your class path):
MultiLayerNetwork model = KerasModelImport.importKerasSequentialModelAndWeights(fullModel, false);
To load just the model configuration from JSON, you use KerasModelImport
as follows:
In the latter two cases no training configuration will be read.