add spatialdropoutlayer (class) to Simulink.

조회 수: 8 (최근 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 CenterFile Exchange에서 Sequence 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