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!