Conv LSTM input size mismatch error
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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);
0 comentarios
Respuestas (3)
Harsha Priya Daggubati
el 12 de Mayo de 2020
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.
Harsha Priya Daggubati
el 12 de Mayo de 2020
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.
NGR MNFD
el 2 de Jul. de 2021
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
0 comentarios
Ver también
Categorías
Más información sobre Image Data Workflows en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!