I am getting very poor training when I follow the 3-D Segmentation Using Deep Learning on brain tumour example with my own data.

1 view (last 30 days)
I have adapted the example code to work with three rather than four modalities and used my own data.
The results are very poor.
Also when I start training my mini-batch loss starts and stays at 1.0:
|======================================================================================================================|
| Epoch | Iteration | Time Elapsed | Mini-batch | Validation | Mini-batch | Validation | Base Learning |
| | | (hh:mm:ss) | Accuracy | Accuracy | Loss | Loss | Rate |
|======================================================================================================================|
| 1 | 1 | 00:05:13 | 33.17% | 26.18% | 1.0000 | 1.0000 | 5.0000e-05 |
| 1 | 50 | 00:09:20 | 22.81% | | 1.0000 | | 5.0000e-05 |
| 1 | 100 | 00:18:24 | 30.37% | 23.97% | 1.0000 | 1.0000 | 5.0000e-05 |
| 1 | 150 | 00:22:48 | 19.96% | | 1.0000 | | 5.0000e-05 |
| 1 | 200 | 00:31:59 | 20.83% | 20.40% | 1.0000 | 1.0000 | 5.0000e-05 |
| 2 | 250 | 00:35:18 | 19.10% | | 1.0000 | | 5.0000e-05 |
| 2 | 300 | 00:42:47 | 24.38% | 21.29% | 1.0000 | 1.0000 | 5.0000e-05 |
| 2 | 350 | 00:45:49 | 9.39% | | 1.0000 | | 5.0000e-05 |
my training options are:
options = trainingOptions('adam', ...
'ExecutionEnvironment','multi-gpu', ... % Turn on automatic multi-gpu support.
MaxEpochs=500, ...
InitialLearnRate=5e-5, ... % was 5e-4
LearnRateSchedule="piecewise", ...
LearnRateDropPeriod=5, ...
LearnRateDropFactor=0.98, ... % was 0.95
ValidationData=dsVal, ...
ValidationFrequency=100, ... % was 400
Plots="training-progress", ...
Verbose=true, ...
MiniBatchSize=miniBatchSize);
numChannels = 3;
inputPatchSize = [patchSize numChannels];
numClasses = 5;
[lgraph,outPatchSize] = unet3dLayers(inputPatchSize,numClasses,ConvolutionPadding="valid");
dsTrain = transform(patchds,@(patchIn)augmentAndCrop3dPatch(patchIn,outPatchSize,"Training"));
dsVal = transform(dsVal,@(patchIn)augmentAndCrop3dPatch(patchIn,outPatchSize,"Validation"));
outputLayer = dicePixelClassificationLayer(Name="Output");
lgraph = replaceLayer(lgraph,"Segmentation-Layer",outputLayer);
inputLayer = image3dInputLayer(inputPatchSize,Normalization="none",Name="ImageInputLayer");
lgraph = replaceLayer(lgraph,"ImageInputLayer",inputLayer);
inputPatchSize = [132 132 132 3];
outPatchSize = [44 44 44 2];
classNames = ["background","turbKE_03","turbKE_05","turbKE_07","turbKE_1"]
pixelLabelID = [0 1 2 3 4];

Answers (1)

Himanshu
Himanshu on 26 May 2023
Hello Andy,
I understand that you are facing issues while training "3-D Brain Tumor Segmentation Using Deep Learning" example on your own data. This issue can occur due to various reasons, such as incorrect data alignment, inadequate data augmentation, inappropriate hyperparameter settings, suboptimal model architecture, insufficient training duration, or class imbalance.
You can follow the below steps to resolve this issue:
  1. Data-related Issues: Verify data alignment and preprocessing to ensure input and labels are correctly aligned. Check for anomalies or inconsistencies in the data that might affect training.
  2. Data Augmentation: Adjust the intensity or types of transformations applied during augmentation. Experiment with different augmentation strategies to find the right balance.
  3. Hyperparameter Tuning: Tune the learning rate, batch size, and dropout rate to optimize the model's performance. Reduce the learning rate or adjust the drop factor for slower rates of decay.
  4. Model Architecture: Modify the architecture by adding or removing layers, adjusting the number of filters, or trying different layer types. Ensure the complexity and depth of the network are suitable for your dataset.
  5. Training Duration: Increase the number of epochs or train for a longer duration to allow the model to converge effectively.
  6. Class Imbalance: Apply class balancing techniques such as class weighting or oversampling/undersampling to address any significant class imbalance.
You can refer to the below documentation to learn more about Data Alignment and Preprocessing, Data Augmentation and Class Imbalance in MATLAB.

Community Treasure Hunt

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

Start Hunting!