deeplearning4j / deeplearning4j

Suite of tools for deploying and training deep learning models using the JVM. Highlights include model import for keras, tensorflow, and onnx/pytorch, a modular and tiny c++ library for running math code and a java based math library on top of the core c++ library. Also includes samediff: a pytorch/tensorflow like library for running deep learn...
http://deeplearning4j.konduit.ai
Apache License 2.0
13.61k stars 3.83k forks source link

LeakyRelu in Keras is not supported #3669

Closed hristo-vrigazov closed 7 years ago

hristo-vrigazov commented 7 years ago

Issue Description

I created a Keras model adaptation for the YOLO neural network for object detection. When I tried to import it in Deep Learing 4J, it can't do that because it does not support the LeakyRelu layer. You can download the configuration and weights from these links: configuration, weights When I run:

MultiLayerNetwork network = KerasModelImport.importKerasSequentialModelAndWeights(
                    "yolo_model.json",
                    "yolo_weights.h5");

it throws the following exception:

org.deeplearning4j.nn.modelimport.keras.UnsupportedKerasConfigurationException: Unsupported keras layer type LeakyReLU. Please file an issue at http://github.com/deeplearning4j/deeplearning4j/issues.
    at org.deeplearning4j.nn.modelimport.keras.KerasLayer.getKerasLayerFromConfig(KerasLayer.java:254)
    at org.deeplearning4j.nn.modelimport.keras.KerasModel.helperPrepareLayers(KerasModel.java:190)
    at org.deeplearning4j.nn.modelimport.keras.KerasSequentialModel.<init>(KerasSequentialModel.java:99)
    at org.deeplearning4j.nn.modelimport.keras.KerasSequentialModel.<init>(KerasSequentialModel.java:56)
    at org.deeplearning4j.nn.modelimport.keras.KerasModel$ModelBuilder.buildSequential(KerasModel.java:581)
    at org.deeplearning4j.nn.modelimport.keras.KerasModelImport.importKerasSequentialModelAndWeights(KerasModelImport.java:235)
    at com.play.computer.vision.App.main(App.java:18)

Version Information

Please indicate relevant versions, including, if relevant:

tomthetrainer commented 7 years ago

DeepLearning4J includes LeakyRelu,

https://github.com/deeplearning4j/nd4j/blob/master/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ops/impl/transforms/LeakyReLU.java

If the implementation is the same this might simply be a failure to map the keras leakyRelu to our Leaky relu.

Note to @turambar , to see if he has more information.

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.