How is the smooth dice loss differentiable?

后端 未结 1 1855
遥遥无期
遥遥无期 2021-01-05 10:07

I am training a U-Net in keras by minimizing the dice_loss function that is popularly used for this problem: adapted from here and here

def dsc(         


        
相关标签:
1条回答
  • 2021-01-05 10:33

    Adding smooth to the loss does not make it differentiable. What makes it differentiable is
    1. Relaxing the threshold on the prediction: You do not cast y_pred to np.bool, but leave it as a continuous value between 0 and 1
    2. You do not use set operations as np.logical_and, but rather use element-wise product to approximate the non-differenetiable intersection operation.

    You only add smooth to avoid devision by zero when both y_pred and y_true do not contain any foreground pixels.

    0 讨论(0)
提交回复
热议问题