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

조회 수: 2 (최근 30일)
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);

답변 (1개)

Cris LaPierre
Cris LaPierre 2024년 3월 1일
The error is in how the data is organized in imdsTrain.Labels
It must conform to the following specifications
  댓글 수: 1
Paromita Kundu
Paromita Kundu 2024년 3월 2일
I'm truly grateful for your help. The code is finally working flawlessly. May God bless you abundantly for your assistance.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by