在使用DL4J的Scala项目中,该项目旨在导入Keras模型,我的SBT包含以下Sonatype快照对DL4J和ND4J的依赖关系。由于DL4J Keras Import: 2.2.x/2.3.x compatibility问题,我使用的是Sonatype快照,而不是Maven。
resolvers += Resolver.sonatypeRepo("snapshots")
libraryDependencies ++= Seq(
// https://mvnrepository.com/artifact/org.deeplearning4j/deeplearning4j-core
"org.deeplearning4j" % "deeplearning4j-core" % "1.0.0-SNAPSHOT",
// https://mvnrepository.com/artifact/org.deeplearning4j/deeplearning4j-nn
"org.deeplearning4j" % "deeplearning4j-nn" % "1.0.0-SNAPSHOT",
// https://mvnrepository.com/artifact/org.deeplearning4j/deeplearning4j-modelimport
"org.deeplearning4j" % "deeplearning4j-modelimport" % "1.0.0-SNAPSHOT",
// https://mvnrepository.com/artifact/org.nd4j/nd4j-cuda-9.0
"org.nd4j" % "nd4j-cuda-9.0" % "1.0.0-SNAPSHOT",
// https://mvnrepository.com/artifact/org.nd4j/nd4j-cuda-9.0-platform
"org.nd4j" % "nd4j-cuda-9.0-platform" % "1.0.0-SNAPSHOT",
// https://mvnrepository.com/artifact/org.nd4j/nd4j-api
"org.nd4j" % "nd4j-api" % "1.0.0-SNAPSHOT"
)
然后转到下面的代码段:
import org.deeplearning4j.nn.multilayer.MultiLayerNetwork
import org.deeplearning4j.nn.modelimport.keras.KerasModelImport
val model = KerasModelImport.importKerasSequentialModelAndWeights(
"""{Valid path to a working Keras model saved as an H5 file}""",
true
)
我得到
Class org.nd4j.evaluation.IEvaluation not found - continuing with a stub.
val model = KerasModelImport.importKerasSequentialModelAndWeights(
错误。即使我在DL4J GitHub存储库中看到import org.nd4j.evaluation.IEvaluation;
使用了many times,我也不知道要导入什么才能使其可用。