I am relatively new to Java and am currently working on a neural network in deeplearning4j. I've got a sequential Keras model (.h5) and try to import it into my project using the following lines:
String path = "C:\\Users\\username\\Documents\\AIProject\\AiProjectDl4j\\data\\InceptionResNetV2CatAndDog.h5";
MultiLayerNetwork model = KerasModelImport.importKerasSequentialModelAndWeights(path);
However, when I run the code I get the following error that I cannot find any solution to online:
Exception in thread "main" java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to java.util.List
at org.deeplearning4j.nn.modelimport.keras.KerasSequentialModel.<init>(KerasSequentialModel.java:102)
at org.deeplearning4j.nn.modelimport.keras.KerasSequentialModel.<init>(KerasSequentialModel.java:61)
at org.deeplearning4j.nn.modelimport.keras.utils.KerasModelBuilder.buildSequential(KerasModelBuilder.java:320)
at org.deeplearning4j.nn.modelimport.keras.KerasModelImport.importKerasSequentialModelAndWeights(KerasModelImport.java:195)
at catsdogs.Model.main(Model.java:80)
Line 80 is the line with the Keras import. I would be very thankful for any kind of help since I don't even get why it says anything about Hashmap being cast to List since I don't have either anywhere near my code and the MultiLayerNetwork isn't of either type. If there is any other way to import your own .h5 model, I'd try that as well.