Keras loss functions

radio.models.keras.losses.dice_loss(y_true, y_pred, smooth=1e-06)[source]

Loss function base on dice coefficient.

Parameters:
  • y_true (keras tensor) – tensor containing target mask.
  • y_pred (keras tensor) – tensor containing predicted mask.
  • smooth (float) – small real value used for avoiding division by zero error.
Returns:

tensor containing dice loss.

Return type:

keras tensor

radio.models.keras.losses.tversky_loss(y_true, y_pred, alpha=0.3, beta=0.7, smooth=1e-10)[source]

Tversky loss function.

Parameters:
  • y_true (keras tensor) – tensor containing target mask.
  • y_pred (keras tensor) – tensor containing predicted mask.
  • alpha (float) – real value, weight of ‘0’ class.
  • beta (float) – real value, weight of ‘1’ class.
  • smooth (float) – small real value used for avoiding division by zero error.
Returns:

tensor containing tversky loss.

Return type:

keras tensor

radio.models.keras.losses.jaccard_coef_logloss(y_true, y_pred, smooth=1e-10)[source]

Loss function based on jaccard coefficient.

Parameters:
  • y_true (keras tensor) – tensor containing target mask.
  • y_pred (keras tensor) – tensor containing predicted mask.
  • smooth (float) – small real value used for avoiding division by zero error.
Returns:

tensor containing negative logarithm of jaccard coefficient.

Return type:

keras tensor