Generate Simulink Model from Sequence Classification Network for Road Damage Detection - MATLAB & Simulink (original) (raw)
Main Content
This example shows how to automatically generate a Simulink® model from a quantized sequence classification network.
This example is step four in a series of examples that shows how to train and compress a neural network to classify timeseries of accelerometer data according to whether a vehicle drove over cracked or uncracked sections of pavement. You can run each step independently or you can work through the steps in order. The previous example shows how to use Experiment Manager to tune the compression parameters of the neural network. Now, export the compressed network to Simulink.
Export Network to Simulink
Load the compressed network, memory, and accuracy information of the trial with the best accuracy from step three of the series. If you have already run the previous step, use the data and network in your workspace.
if ~exist("trialBestAccuracy","var") load("trialBestAccuracy.mat") end net = trialBestAccuracy.Outputs.netQuantized{1};
A network that operates on sequences of input data rather than individual data points is called a frame-based network. A network that operates on individual data points is called a sample-based network. For more information on sample- and frame-based concepts, see Sample- and Frame-Based Concepts (DSP System Toolbox).
Export the network to Simulink using the exportNetworkToSimulink function. Specify that net
is a frame-based network by setting the FrameBased
name-value argument to true
.
exportNetworkToSimulink(net,FrameBased=true);
The top level of the generated model is a subsystem block that contains the entire network.
To explore the individual layer blocks for the layers in the network, double-click the subsystem block.
See Also
exportNetworkToSimulink | Zerocenter 1D | Convolution 1D Layer | ReLU Layer | Max Pooling 1D Layer | Fully Connected Layer | Global Average Pooling 1D Layer | Softmax Layer