Why wont a seriesnetwork object compile in Simulink?

2 ビュー (過去 30 日間)
Matthew Bigelow
Matthew Bigelow 2019 年 1 月 3 日
コメント済み: Prajith Chilummula 2019 年 1 月 11 日
I have trained a sequence to sequence LTSM deep classification network with the veiw of implementing it in simulink to classify EEG data coming in timesteps. The networks has the following layers and options shown in the below code. Im able to classify new data in matlab using classifyAndUpdateState(net,timestepdata) like shown in the code below.
However once I use the classify function inside a simulink program to classify new incoming data (coming in the same format as the trained network) the program wont compile as it does not recognise the net object. How can I get around this or alternatively how can I implement the trained LTSM net in Simulink. (obviously cant use gensim etc for a series network)
layers = [ ...
sequenceInputLayer(20)
bilstmLayer(100,'OutputMode','sequence')
bilstmLayer(100,'OutputMode','sequence')
bilstmLayer(100,'OutputMode','sequence')
bilstmLayer(100,'OutputMode','sequence')
fullyConnectedLayer(3)
softmaxLayer
classificationLayer
]
%%
options = trainingOptions('adam', ...
'MaxEpochs',300, ...
'InitialLearnRate', 0.01, ...
'GradientThreshold', 1, ...
'plots','training-progress', ...
'Verbose',false, ...
'ValidationData',{XTestReady,YTestReady}, ...
'ValidationFrequency',1);
%for classifying new data in timesteps
for i = 1:numTimeSteps
v = X(:,i);
[net,label,score] = classifyAndUpdateState(LTSMnet,v);
labels(i) = label;
end
  1 件のコメント
Prajith Chilummula
Prajith Chilummula 2019 年 1 月 11 日
You can save the 'net' variable in a mat file and load the mat file in the MATLAB function and use the function as MATLAB function block.
Also please refer the below link:
https://www.mathworks.com/matlabcentral/answers/40701-using-workspace-data-in-matlab-function-block-simulink

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

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by