I am getting error while training CNN network

1 次查看(过去 30 天)
imds = imageDatastore('FCD','IncludeSubfolders',true,'LabelSource','foldernames');
imds.ReadFcn = @readtrain;
[imdsTrain,imdsTest] = splitEachLabel(imds,0.7,'randomized');
layers=[imageInputLayer([224 224 3])
convolution2dLayer(3,8,'Padding','same')
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(3,16,'Padding','same')
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(3,32,'Padding','same')
batchNormalizationLayer
reluLayer
fullyConnectedLayer(8)
softmaxLayer
classificationLayer];
options = trainingOptions('sgdm', ...
'Plots', 'training-progress', ...
'LearnRateSchedule', 'piecewise', ...
'LearnRateDropFactor', 0.2, ...
'LearnRateDropPeriod', 5, ...
'MiniBatchSize', 300);
options.MaxEpochs = 30;
options.InitialLearnRate=0.001;
convert=trainNetwork(imdsTrain,layers,options);
in read train I have used the resizing of the images but i am getting an error
Error using trainNetwork (line 184)
Unexpected image size: All images must have the same size.
Error in NewCnn (line 34)
convert=trainNetwork(imdsTrain,layers,options);
can anyone please help me with it how to run this program without any error.thank you in advance

回答(1 个)

Anshika Chaurasia
Anshika Chaurasia 2021-6-16
Hi,
You can refer to the following discussion on similar issue:
Hope it helps!

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by