Skip to content

Instantly share code, notes, and snippets.

@choowilson
Created February 12, 2020 07:45
Show Gist options
  • Save choowilson/7504ec08b83b5bf0f2304c57395f4a0a to your computer and use it in GitHub Desktop.
Save choowilson/7504ec08b83b5bf0f2304c57395f4a0a to your computer and use it in GitHub Desktop.
method to import keras model in dl4j
import org.deeplearning4j.nn.graph.ComputationGraph;
import org.deeplearning4j.nn.modelimport.keras.KerasModelImport;
import org.deeplearning4j.nn.modelimport.keras.exceptions.InvalidKerasConfigurationException;
import org.deeplearning4j.nn.modelimport.keras.exceptions.UnsupportedKerasConfigurationException;
public void initKeras() throws InvalidKerasConfigurationException, IOException, UnsupportedKerasConfigurationException {
ComputationGraph model = KerasModelImport.importKerasModelAndWeights("model.h5");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment