I’m getting the following error when i try to load .h5 model in scala using
KerasModelImport.importKerasModelAndWeights().
Exception in thread "streaming-job-executor-1" java.lang.NoClassDefFoundError: Could not initialize class org.deeplearning4j.nn.modelimport.keras.Hdf5Archive
at org.deeplearning4j.nn.modelimport.keras.utils.KerasModelBuilder.modelHdf5Filename(KerasModelBuilder.java:229)
at org.deeplearning4j.nn.modelimport.keras.KerasModelImport.importKerasModelAndWeights(KerasModelImport.java:166)
Dependency jar files added in the code
The dependencies added in my program are shown in the above image. Along with that I installed libhdf5-dev
and set path to it. But I’m getting the same error.
My code is written in scala language. This is how I tried to load the model:
val model: ComputationGraph = KerasModelImport.importKerasModelAndWeights(modelPath)
I have also imported the following in my program:
import org.deeplearning4j.nn.graph.ComputationGraph
import org.deeplearning4j.nn.conf.ComputationGraphConfiguration
import org.deeplearning4j.nn.multilayer.MultiLayerNetwork
import org.deeplearning4j.util.ModelSerializer
import org.deeplearning4j.nn.modelimport.keras.KerasModelImport
import org.deeplearning4j.nn.modelimport.keras.Hdf5Archive
I’m not sure if it is the version mismatch. Can anyone suggest what’s wrong here. I’m new to deeplearning4j library.