add spatialdropoutlayer (class) to Simulink.

8 visualizaciones (últimos 30 días)
Seyed Mahmoud Seyedi Sahebari
Seyed Mahmoud Seyedi Sahebari el 25 de Mzo. de 2025
Respondida: Katja Mogalle el 29 de Abr. de 2025
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 comentarios
Walter Roberson
Walter Roberson el 25 de Mzo. de 2025
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 el 25 de Mzo. de 2025
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

Iniciar sesión para comentar.

Respuestas (1)

Katja Mogalle
Katja Mogalle el 29 de Abr. de 2025
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

Categorías

Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.

Productos


Versión

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by