I am getting error while training CNN network

1 visualización (últimos 30 días)
Pasupuleti Sowgandhi
Pasupuleti Sowgandhi el 10 de Jun. de 2021
Respondida: Anshika Chaurasia el 16 de Jun. de 2021
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

Respuestas (1)

Anshika Chaurasia
Anshika Chaurasia el 16 de Jun. de 2021
Hi,
You can refer to the following discussion on similar issue:
Hope it helps!

Categorías

Más información sobre Image Data Workflows en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by