Problem using Stateful Predict block

11 ビュー (過去 30 日間)
MD RAHAT
MD RAHAT 2023 年 8 月 8 日
回答済み: MathWorks Support Team 2023 年 11 月 2 日
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.
  1. 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.

採用された回答

MathWorks Support Team
MathWorks Support Team 2023 年 11 月 1 日
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.

その他の回答 (1 件)

Sarthak
Sarthak 2023 年 8 月 22 日
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.

カテゴリ

Help Center および File ExchangeDeep Learning with Simulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by