Conv LSTM input size mismatch error

조회 수: 22(최근 30일)
Shraddha Naidu
Shraddha Naidu 2020년 5월 9일
답변: NGR MNFD 2021년 7월 2일
I have a cell array of dimension tIN{2000,1} and each element in the cell array is a 100x21 the ouput to that is tOUT{2000,1} with each element also of dimensino 100x21
when training I get the error Invalid training data. Responses must be a matrix of numeric responses, or a N-by-1 cell array of sequences, where N is
the number of sequences. The feature dimension of all sequences must be the same.
How do I fix this?
Error in CONv (line 23)
net = trainNetwork(tIN,tOUT,lgraph,options);
The current code is:
% Define Network Layers
layers = [sequenceInputLayer([100,21,1],'Name','input')
maxPooling2dLayer([4 4],'Stride',2,'Name','max')
lgraph = layerGraph(layers);
lgraph = connectLayers(lgraph,'fold/miniBatchSize','unfold/miniBatchSize');
%Training Options
options = trainingOptions('adam', ...
'InitialLearnRate',0.0001, ....
'ExecutionEnvironment','cpu', ...
'MaxEpochs',100, ...
net = trainNetwork(tIN,tOUT,lgraph,options);


Harsha Priya Daggubati
Harsha Priya Daggubati 2020년 5월 12일
I guess you are trying to do sequence to sequence classification of your data using LSTM's. From the data you provided, I can infer you have a training set with 2000 samples, where each sample has 100 features, with 21 values for each feature. Similarly the Responses/labels is also a 2000 x 1 cell array.
I doubt the issue is with the elements of your responses being a cell array of 100 X 21. It is usually expected to be 1 X 21.
You can refer to HumanActivityTrain dataset in MATLAB to help you organise your data.
  댓글 수: 1
Shraddha Naidu
Shraddha Naidu 2020년 5월 12일
I am actually trying to do a sequence to sequence regression so I need a 100x21 output. Is there a way around it?

댓글을 달려면 로그인하십시오.

Harsha Priya Daggubati
Harsha Priya Daggubati 2020년 5월 12일
As far as I know, you will be able to assign one class at each time step based on the feature values. So you would need 100 X 21 response for each sample.
This example speaks the same too.
  댓글 수: 1
Shraddha Naidu
Shraddha Naidu 2020년 5월 12일
This link follows a regression and not classification.
But it does not implement convolution?

댓글을 달려면 로그인하십시오.

NGR MNFD 2021년 7월 2일
Hello . I hope you have a good day. I sent the article to your service. I implemented the coding part in the MATLAB software, but to implement my network, two lines of setlayers, training MATLAB 2014 give me an error. What other function do you think I should replace? Do you think the codes I wrote are correct?( I used gait-in-neurodegenerative-disease-database in physionet website.) Thanks a lot

Community Treasure Hunt

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

Start Hunting!

Translated by