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개)

카테고리

Help CenterFile Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by