3-D Brain Tumor Segmentation ERROR
Show older comments
Hi all,
I'm getting the following error running the 3-D Brain Tumor Segmentation example
Error using trainNetwork (line 165)
Incorrect loss type returned by 'forwardLoss' in the output layer. Expected to be 'single', but instead was 'gpuArray'.
The output layer is dicePixelClassification3dLayer. It seems like there's some kind of error in the definition of that custom layer. Converting to single the outputs of the layer methods didn't help, same error.
If it's helpful I'm using r2019a on windows 10 on a i9 9900k + 1080ti.
Any Help?
Thanks
6 Comments
Joss Knight
on 24 Aug 2019
You were also getting the "GPU low on memory" warning, yes? This is an artifact of custom layers and low memory, and is best fixed by reducing memory load (reduce minibatch size or patches per image).
Roberto
on 24 Aug 2019
Joss Knight
on 25 Aug 2019
My experience with the brain segmentation example was that it is a good demonstration of how to get started with U-Net, but it does need some tuning, of hyper parameters and data augmentation. Also remember that after reducing the mini-batch size the network doesn't have much to go on when determining the accuracy of each iteration, especially given that this is a binary classification. Out of a handful of sample patches sometimes (often?) they'll all be classified correctly even when the network hasn't successfully converged. You're better off focussing on the validation accuracy (which itself needs some tuning) and the loss. I think the high-looking loss is an artifact of the custom DICE classification layer.
This issue with the error is fixed in a future version.
Joss Knight
on 25 Aug 2019
Edited: Joss Knight
on 25 Aug 2019
By the way, I believe you can also fix this by converting the output of the forwardLoss method of the dicePixelClassificationLayer from gpuArray back to ordinary arrays using gather. Something like
loss = gather(loss);
should do the trick.
Joss Knight
on 26 Aug 2019
The type problem and the low memory warning go together. If you're getting the low memory warning, you have a real problem that needs addressing, otherwise training performance will be seriously affected. The fix for the type error will allow training to continue, but you'll still need to deal with the low memory issue.
Accepted Answer
More Answers (0)
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!