2

I am struggling to implement the generalized Dice loss for Caffe as Python Layer, which calculates loss for sub-volumes. I am hoping to get some help here. Or at least, if there is any code, please share the link.

I have 5 labels (0: background and labels1:4 for objects). Since I am getting a patch from 3D data, some of the subvolumes only contain the background. How the dice loss should be calculated for this sub-volumes?

Why in this line of code for creating One-hot label, the author has separated the background voxels counting?

Do we calculate the volume overlap for the background voxels too?

S.EB
  • 1,966
  • 4
  • 29
  • 54
  • I do not have the answer to your question yet, but here is a gist of my implementation of the generalized dice loss for the case of image data: https://gist.github.com/srcolinas/6df2e5e21c11227a04f826322081addf – srcolinas Feb 02 '19 at 15:10
  • @srcolinas thank you very much for the link, I have implemented the forward pass. In `TensorFlow`, it seems that gradients are automatically calculated, however, `Caffe` does not have such ability. I even implemented the gradients for `backward` pass, but it seems I am doing some mistakes somewhere. Like, I do not know how to calculate the gradient for the `background` and calculate it once we have more than 2 labels. Milletari has implemented for binary Dice in [this link](https://github.com/faustomilletari/VNet/blob/master/pyLayer.py#L61), but I could not relate it to multi-label Dice loss! – S.EB Feb 05 '19 at 03:20

0 Answers0