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)
Afficher commentaires plus anciens
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);
0 commentaires
Réponses (1)
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
Voir également
Catégories
En savoir plus sur Image Data Workflows dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!