MATLAB Answers

How can I do mutli-class classification with the 3D Unet ?

18 views (last 30 days)
Atallah Baydoun
Atallah Baydoun on 22 Aug 2019
Commented: Atallah Baydoun on 6 Nov 2019
The 3D Unet segmentation example features a binary class classification.
I was tying to extend the example to multi-class classification but I kept on having a constant loss function.
Was anyone able to perform multi-class classification with the 3D unet in matlab ?

Answers (1)

Shashank Gupta
Shashank Gupta on 27 Aug 2019
Multiclass classifiers are very similar to binary classifier, you may need to change the last layer of your model to make the multiclass classifier output compatible with your model. There is a function available in MATLAB "pixelLabelDatstore", which can generate the pixel label images that in turn may be used as a label data target in your network for semantic segmentation.
Also, there can be many reasons to get a constant loss function, Data imbalance could be one. Try using a weighted multiclass Dice loss function instead of “crossentropy”.
If that does not help, try using an adaptive learning rate for your network. Also check the target images before feeding it to your network, sometimes the target and predictive images comes out to be transpose of each other because of how the MATLAB handles the data.
May be 3D tumor segmentation example can help you set up your model.
  3 Comments
Atallah Baydoun
Atallah Baydoun on 6 Nov 2019
Hey Shashank,
Another technical question came up and I was wondering if you can help with understanding the choice of data for the minibatch.
Let us assume that we have 20 images, and we chose only one patch per image. This will give us a total of 20 patches.
Let us also suppose that we chose our minibatch size to be 5.
At each iteration, trainnetwork will choose 5 patches among the 20 to create its minibatch.
How is the selection process done ? Is it completely random ? I have tried to debug the trainNetwork code but I couldn't find anything ?
Thanks,
Atallah

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by