如何从Matlab调用描述Keras-Tensorflow模型的Python代码?

时间:2020-06-22 13:22:12

标签: python matlab tensorflow keras deep-learning

我遇到了使用Tensorflow-keras构建深层神经网络(无卷积)的情况,但是无法将模型导入到matlab中。

这是我的模特

model = keras.models.Sequential()
model.add(keras.layers.Flatten(input_shape=[28, 28]))
model.add(keras.layers.Dense(300, activation="elu", kernel_initializer = 'he_normal'))
model.add(Dropout(0.1))
model.add(keras.layers.Dense(300, activation="elu", kernel_initializer = 'he_normal'))
model.add(Dropout(0.1))
model.add(keras.layers.Dense(10, activation="softmax"))

到目前为止我的进步

clc;
modelfile = 'keras_neural_fashion_MNIST_Nadam.h5';

net = importKerasNetwork(modelfile)

返回错误

Error using importKerasNetwork (line 94)
Unable to import network because some network
layers are not yet supported. To import layers
and weights, call importKerasLayers with
'ImportWeights' set to true.
Error in import_keras (line 5)
net = importKerasNetwork(modelfile) 

反正我是否可以从主Matlab程序中调用包含tensorflow-keras模型的那段python代码?

谢谢!

0 个答案:

没有答案