I am unable to find the errror.....
1 view (last 30 days)
Show older comments
%------------------------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 Comments
Guillaume
on 20 Dec 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.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!