How to Solve this, Semantic Segmentation with Dice Loss
3 次查看(过去 30 天)
显示 更早的评论
My images are with 256 X 256 in size
I am doing semantic segmentation with dice loss.
ds = pixelLabelImageDatastore(imdsTrain,pxdsTrain);
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)
convolution2dLayer(1,3)
softmaxLayer
dicePixelClassificationLayer('dice')
]
opts = trainingOptions('sgdm', 'InitialLearnRate',1e-3, 'MaxEpochs',10, 'LearnRateDropFactor',1e-1, 'LearnRateDropPeriod',50, 'LearnRateSchedule','piecewise', 'MiniBatchSize',32);
net = trainNetwork(ds,layers,opts);
Errors are :-
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 net_net (line 110)
net = trainNetwork(ds,layers,opts);
The output size ([512 512 3]) of the last layer does not match the response size ([256 256 3]).
4 个评论
Walter Roberson
2019-12-18
I do not know what the cause of the problem is, but you could try adding a resize layer on the bottom.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!