It is possible to implement a LSTM neural network built with Keras Python in a Simulink block?

2 views (last 30 days)
Hello!
I have a LSTM neural network (for time series prediction) built in Python with Keras. So I have the model (structure and weights) in .h5 file.
It is possible to implement a LSTM neural network built with Keras Python in a Simulink block?
I would to create a simulink file that takes in input 2 signals and passing through the NN block , gives me as output the predicted signal.
  2 Comments

Sign in to comment.

Answers (2)

Oskar Karnblad
Oskar Karnblad on 11 Jan 2018
I'm also interested in this. Have you found a solution yet?

Arkadiy Turevskiy
Arkadiy Turevskiy on 18 Oct 2021
You can do it in two steps:
  1. Import a model into MATLAB. See this function for TensrFlow 2 or this function to import from Keras.
  2. Once you have imported the model, use Stateful Predict block. This block became available in 21a.
HTH.
Arkadiy

Community Treasure Hunt

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

Start Hunting!