Conv LSTM input size mismatch error

2 次查看(过去 30 天)
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')
sequenceFoldingLayer('Name','fold')
convolution2dLayer(5,20,'Name','Conv')
maxPooling2dLayer([4 4],'Stride',2,'Name','max')
sequenceUnfoldingLayer('Name','unfold')
flattenLayer('Name','flat')
lstmLayer(100,'Name','lstm','OutputMode','Sequence')
dropoutLayer(0.2,'Name','drop')
fullyConnectedLayer(1,'Name','fc2')
regressionLayer('Name','output')];
lgraph = layerGraph(layers);
lgraph = connectLayers(lgraph,'fold/miniBatchSize','unfold/miniBatchSize');
%Training Options
options = trainingOptions('adam', ...
'InitialLearnRate',0.0001, ....
'ExecutionEnvironment','cpu', ...
'MaxEpochs',100, ...
'Plots','training-progress','Shuffle','every-epoch','L2Regularization',0.0005);
net = trainNetwork(tIN,tOUT,lgraph,options);

回答(3 个)

Harsha Priya Daggubati
Hi,
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
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
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

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by