MATLAB Answers

Error: Importing Keras networks with more than 1 input or output layer is not yet supported.

조회 수: 2(최근 30일)
Xu Fei
Xu Fei 24 Mar 2020
Hello,
I am using matlab 2019b.
I was going to import a pretrained Keras-tensorflow network in matlab, so I downloaded the latest version of "Deep Learning Toolbox Importer for TensorFlow-Keras Models" (available here: https://www.mathworks.com/matlabcentral/fileexchange/64649-deep-learning-toolbox-importer-for-tensorflow-keras-models).
I used the following command:
modelfile = 's2_038_model.json';
weights = 's2_038_lr_1e-04.h5';
net = importKerasNetwork(modelfile,'WeightFile',weights,'OutputLayerType','regression')
However I got this error: "Importing Keras networks with more than 1 input or output layer is not yet supported."
I notice that the latest version of this tool box already allows to import multiple inputs/outputs network, but how does this error happen?
Anyone has the same problem as mine?
Wish online friends could help me with some solutions, thanks in advance!

답변(1개)

Sivylla Paraskevopoulou
편집: Sivylla Paraskevopoulou 12 Feb 2021
Since R2020a, you can import a Keras network with multiple inputs and multiple outputs. Try downloading a R2020a version or later of the support package. Use importKerasNetwork if the network includes input size information for the inputs and loss information for the outputs. Otherwise, use importKerasLayers. The importKerasLayers function inserts placeholder layers for the inputs and outputs. After importing, you can find and replace the placeholder layers by using findPlaceholderLayers and replaceLayer respectively.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by