Effacer les filtres
Effacer les filtres

PlzHelp:Invalid training data. Predictors must be a N-by-1 cell array of sequences, where N is the number of sequences. All sequences must have the same feature dimension and

4 vues (au cours des 30 derniers jours)
inputSize = [224 224 3];
filterSize = 5;
numFilters = 20;
numHiddenUnits = 200;
numClasses = 4;
layers = [ ...
sequenceInputLayer(inputSize,'Name','input')
sequenceFoldingLayer('Name','fold')
convolution2dLayer(filterSize,numFilters,'Name','conv')
batchNormalizationLayer('Name','bn')
reluLayer('Name','relu')
sequenceUnfoldingLayer('Name','unfold')
flattenLayer('Name','flatten')
lstmLayer(numHiddenUnits,'OutputMode','last','Name','lstm')
fullyConnectedLayer(numClasses, 'Name','fc')
softmaxLayer('Name','softmax')
classificationLayer('Name','classification')];
lgraph = layerGraph(layers);
lgraph = connectLayers(lgraph,'fold/miniBatchSize','unfold/miniBatchSize');
miniBatchSize = 32;
options = trainingOptions("adam", ...
'MaxEpochs',3, ...
'MiniBatchSize',32, ...
'InitialLearnRate',0.005, ...
'LearnRateDropPeriod',2, ...
'LearnRateSchedule',"piecewise", ...
'L2Regularization',5e-4, ...
'SequencePaddingDirection',"left", ...
'Shuffle',"every-epoch", ...
'ValidationFrequency',floor(numel(imdsTrain.Files)/miniBatchSize), ...
'ValidationData',{imdsValidation,imdsValidation.Labels}, ...
'Verbose',false, ...
'Plots',"training-progress");
%
net = trainNetwork(imdsTrain.Files,imdsTrain.Labels,lgraph,options);

Réponses (1)

Cris LaPierre
Cris LaPierre le 1 Mar 2024
The error is in how the data is organized in imdsTrain.Labels
It must conform to the following specifications
  1 commentaire
Paromita Kundu
Paromita Kundu le 2 Mar 2024
I'm truly grateful for your help. The code is finally working flawlessly. May God bless you abundantly for your assistance.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Image Data Workflows dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by