tf.keras.losses.dice

Computes the Dice loss value between y_true and y_pred.

Formula:

loss = 1 - (2 * sum(y_true * y_pred)) / (sum(y_true) + sum(y_pred))

y_true tensor of true targets.
y_pred tensor of predicted targets.

Dice loss value.