diff --git a/monai/losses/dice.py b/monai/losses/dice.py index ed88100edd..36bf6b6520 100644 --- a/monai/losses/dice.py +++ b/monai/losses/dice.py @@ -674,6 +674,7 @@ def __init__( lambda_dice: float = 1.0, lambda_ce: float = 1.0, label_smoothing: float = 0.0, + soft_label: bool = False, ) -> None: """ Args: @@ -715,6 +716,8 @@ def __init__( label_smoothing: a value in [0, 1] range. If > 0, the labels are smoothed by the given factor to reduce overfitting. Defaults to 0.0. + soft_label: whether the target contains non-binary values (soft labels) or not. + If True a soft label formulation of the DiceLoss will be used. """ super().__init__() @@ -737,6 +740,7 @@ def __init__( smooth_dr=smooth_dr, batch=batch, weight=dice_weight, + soft_label=soft_label, ) self.cross_entropy = nn.CrossEntropyLoss(weight=weight, reduction=reduction, label_smoothing=label_smoothing) self.binary_cross_entropy = nn.BCEWithLogitsLoss(pos_weight=weight, reduction=reduction)