Effacer les filtres
Effacer les filtres

I am unable to find the errror.....

1 vue (au cours des 30 derniers jours)
Mohammad Bhat
Mohammad Bhat le 20 Déc 2019
Modifié(e) : per isakson le 21 Déc 2019
%------------------------Data STores--------------------------------------%
dataSetDir = 'C:\Users\idree\Desktop\Main\ultimate\'
imageDir = fullfile(dataSetDir,'o_binary');
labelDir = fullfile(dataSetDir,'l_binary');
imds = imageDatastore(imageDir);
%-------------------------------------------------------------------------%
classNames = ["shirorekha" "character" "background"];
labelIDs = [1 2 3];
pxds = pixelLabelDatastore(labelDir, classNames, labelIDs);
layers = [
imageInputLayer([256 256 1])
convolution2dLayer(3,32,'Padding',1)
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(3,32,'Padding',1)
reluLayer
transposedConv2dLayer(4,32,'Stride',2,'Cropping',1)
reluLayer
transposedConv2dLayer(4,32,'Stride',2,'Cropping',1)
reluLayer
convolution2dLayer(1,3)
softmaxLayer
dicePixelClassificationLayer('dice')
]
ds = pixelLabelImageDatastore(imds,pxds);
options = trainingOptions('sgdm', ...
'InitialLearnRate',1e-3, ...
'MaxEpochs',100, ...
'LearnRateDropFactor',0.1, ...
'LearnRateDropPeriod',50, ...
'LearnRateSchedule','piecewise', ...
'MiniBatchSize',32);
net = trainNetwork(ds,layers,options);
-------------------------------------------------------------------------------------------------------
Error using trainNetwork (line 165)
Invalid training data. The output size ([512 512 3]) of the last layer does not match the response size ([256 256 3]).
Error in dice_try_data (line 35)
net = trainNetwork(ds,layers,options);
  2 commentaires
Guillaume
Guillaume le 20 Déc 2019
The error message seems clear to me, your neural net expects 256x256 image but is getting 512x512 images.
I know nothing about the neural net toolbox so can't help any further.
Mohammad Bhat
Mohammad Bhat le 21 Déc 2019
Modifié(e) : per isakson le 21 Déc 2019
I solved by adding maxpooling layer at the end....
...............................................................
...............................................................
layers = [
imageInputLayer([256 256 1])
convolution2dLayer(3,32,'Padding',1)
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(3,32,'Padding',1)
reluLayer
transposedConv2dLayer(4,32,'Stride',2,'Cropping',1)
reluLayer
transposedConv2dLayer(4,32,'Stride',2,'Cropping',1)
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(1,3)
softmaxLayer
dicePixelClassificationLayer('dice')
]

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Image Data Workflows dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by