Problem using Stateful Predict block
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
MD RAHAT
il 8 Ago 2023
Risposto: MathWorks Support Team
il 2 Nov 2023
I have a trained LSTM model in mat file. I am using stateful predict block in simulink to run a simulation but facing two problems.
- when using stateful predict output as an input (loopback), its giving below error. But when using normal signal block, its working fine
The prediction sequences are of feature dimension 1 but the input layer expects sequences of feature dimension 5. Function 'Stateful Predict/MLFB' (#675.166.360), line 5, column 19: "deep.blocks.internal.sequenceNetworkPredict({in_1}, {size(in_1)}, {class(in_1)},"
2. I am giving scaled input (0-1) and getting prediction in scaled way while using the mat file in matlab editor. But using the same input and model in stateful predict block, output is ranging 0-3. why is that.
0 Commenti
Risposta accettata
MathWorks Support Team
il 1 Nov 2023
The Stateful Predict block requires explicit data dimension definitions. To allow Simulink to resolve the input and output dimensions of the Stateful Predict block, add a Signal Specification block feeding the input of the Stateful Predict block. In the "Dimensions" field of the Signal Specification block, specify the input dimensions of the Stateful Predict block.
0 Commenti
Più risposte (1)
Sarthak
il 22 Ago 2023
Hi MD Rahat,
As per my understanding, the error indicates that the input sequences expected by the LSTM model is different than what is provided. Please make sure that the input sequences you provide to the stateful predict block have the same feature dimension as the model expects.
It is difficult to pinpoint what is causing this error, but the loopback can be one of the reasons. You may need to investigate how the loopback connection is implemented in your Simulink model and ensure that the loopback connection preserves the correct dimensionality of the signal when passing it back as an input. You might need to reshape or modify your input data to match the expected feature dimension of the model.
For the difference in output scaling, it is possible that the scaling applied during training was not preserved when saving the model to the mat file. You can try to manually apply the same scaling to the input data in the stateful predict block.
0 Commenti
Vedere anche
Categorie
Scopri di più su Deep Learning with Simulink in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!