add spatialdropoutlayer (class) to Simulink.

7 ビュー (過去 30 日間)
Seyed Mahmoud Seyedi Sahebari
Seyed Mahmoud Seyedi Sahebari 2025 年 3 月 25 日
回答済み: Katja Mogalle 2025 年 4 月 29 日
I created a 1D CNN network including a "spatialdropoutlayer" which is in the form of class (.m file). I want to integrate this trained CNN in Simulik, convert to C and update to a controller. when I added the trained network to the stateful classify block, it errors that can't read the spatialdropoutlayer.
How can I solve the issue? Is there a way to call the class to the Simulink? Is there any other block that can be recieve the CNN and layer?
  2 件のコメント
Walter Roberson
Walter Roberson 2025 年 3 月 25 日
I was going to suggest,
If you are using a dlnetwork then you can use exportNetworkToSimulink() https://www.mathworks.com/help/deeplearning/ref/dlnetwork.exportnetworktosimulink.html
However, I see in the list of supported layers https://www.mathworks.com/help/deeplearning/ug/list-of-deep-learning-layer-blocks.html that spatialDropoutLayer is not one of the supported layers (but dropoutLayer is supported but does nothing in the converted network.)
Walter Roberson
Walter Roberson 2025 年 3 月 25 日
I was going to suggest,
Create and train a dlnetwork in MATLAB, and save() it to a .mat file.
Then in Simulink, use a Simulink Predict block https://www.mathworks.com/help/deeplearning/ref/predict.html
However, dlnetwork are only useful for prediction, not for classification

サインインしてコメントする。

回答 (1 件)

Katja Mogalle
Katja Mogalle 2025 年 4 月 29 日
Dropout is typically only used during the training phase to make the network generalize better and make it more robust. During inference, the dropout layers don't do anything (as Walter indicated in his first response). So one solution would be to remove the dropout layer before exporting the network to Simulink. You can do this removel in the Deep Network Designer app or in the command line using the functions removeLayers and connectLayers.
Alternatively, you could use the predict block in Simulink (as mentioned by Walter). Here an example that also shows how to get the classification results: https://uk.mathworks.com/help/deeplearning/ug/classify-images-in-simulink-with-imported-tensorflow-network.html

カテゴリ

Help Center および File ExchangeSequence and Numeric Feature Data Workflows についてさらに検索

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by