Porting Network from Keras to Matlab

6 次查看(过去 30 天)
I am trying to port a simple network from python+keras to matlab. Model in question is the following,
def build_network(input_features=None):
# first we specify an input layer, with a shape == features
inputs = Input(shape=(input_features,), name="input")
x = Dense(32, activation='relu', name="hidden1")(inputs)
x = Dense(32, activation='relu', name="hidden2")(x)
x = Dense(32, activation='relu', name="hidden3")(x)
x = Dense(32, activation='relu', name="hidden4")(x)
x = Dense(16, activation='relu', name="hidden5")(x)
# for regression we will use a single neuron with linear (no) activation
prediction = Dense(1, activation='linear', name="final")(x)
model = Model(inputs=inputs, outputs=prediction)
model.compile(optimizer='adam', loss='mean_absolute_error')
return model
Looking throught the list of builtin layers [1]. What I've figured out is keras dense layer is matlab fullyConnectedLayer but i can not find a input layer that is not an lstm layer or an image layer. What would be the matlab equavelent of keras's Input layer?
[1] https://www.mathworks.com/help/deeplearning/ug/list-of-deep-learning-layers.html

回答(1 个)

Sivylla Paraskevopoulou
The MATLAB Deep Learning Toolbox introduced featureInputLayer in R2020b. For more information on how the importTensorFlowNetwork function tranlates TensorFlow-Keras layers to MATLAB layers, see TensorFlow-Keras Layers Supported for Conversion into Built-In MATLAB Layers.

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by