Conv LSTM input size mismatch error

8 ビュー (過去 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')
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
Harsha Priya Daggubati 2020 年 5 月 12 日
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
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
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 Center および File ExchangeSequence 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