I am getting error while training CNN network

조회 수: 1 (최근 30일)
Pasupuleti Sowgandhi
Pasupuleti Sowgandhi 2021년 6월 10일
답변: Anshika Chaurasia 2021년 6월 16일
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