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);
댓글 수: 0
답변 (1개)
Cris LaPierre
2024년 3월 1일
The error is in how the data is organized in imdsTrain.Labels
It must conform to the following specifications
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Data Workflows에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!