U-Net architecture fail to segment the test images.

2 ビュー (過去 30 日間)
Raza Ali
Raza Ali 2021 年 6 月 25 日
コメント済み: Raza Ali 2021 年 7 月 1 日
I am trainng U-Net architecture for semantic segmentation but after training the trained network does not segment the test images.
I am using 500 images (400 training, 50 validation and 50 testing) along with labelled mask to train the network. The training process reaches at 90% validation accuracy after 2nd epoch and remains at same level for rest of the epochs. I tried many possible ways including change in learning rate but it does not work. The images are in JPEG format and labeld mask has png format.
load gTruth % load gTruth file of training data
[imdsTrain,pxdsTrain] = pixelLabelTrainingData(gTruth);
pximdsTrain = pixelLabelImageDatastore(imdsTrain,pxdsTrain);
load gTruth % load gTruth file of Validiation data
[imdsVal,pxdsVal] = pixelLabelTrainingData(gTruth);
pximdsVal = pixelLabelImageDatastore(imdsVal,pxdsVal);
load gTruth % load gTruth file of test data
[imdsTest,pxdsTest] = pixelLabelTrainingData(gTruth)
options = trainingOptions('sgdm', ...
'LearnRateSchedule','piecewise',...
'LearnRateDropPeriod',2,...
'LearnRateDropFactor',0.1,...
'Momentum',0.9, ...
'InitialLearnRate',1e-3, ...
'L2Regularization',0.09, ...
'ValidationData',pximdsVal,...
'MaxEpochs',5, ...
'MiniBatchSize',2, ...
'Shuffle','every-epoch', ...
'VerboseFrequency',50,...
'Plots','training-progress',...
'ValidationFrequency',100);
imageSize = [256 256 1];
numClasses = 2;
Network = unetLayers(imageSize,numClasses)
I repalced cross entropy loss with dice los function.
rng(1) %
Trained_net= trainNetwork(pximdsTrain,Network,options);

採用された回答

ytzhak goussha
ytzhak goussha 2021 年 6 月 30 日
This looks like a case of data imballance.
Check you data, see if there is a dominant class such as back ground you can also look at the predictions and see if they are all the same label.
If there is imballance, you need to use weight in your loss functions compensate for that, and there are other ways
See:
  3 件のコメント
ytzhak goussha
ytzhak goussha 2021 年 7 月 1 日
I'm sorry I didn't understand. Why not use weighted loss? the weight don't have to be exact, so you don't have to recalculate them with every sample.
Raza Ali
Raza Ali 2021 年 7 月 1 日
I have used Balanced cross entropy loss and to comapre the performacne of other loss fucntion I need to implemnt Dice and cross entropy loss as well.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by