dice_loss
DiceLoss
¶
Bases: LossOp
Calculate Dice Loss.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inputs |
Union[Tuple[str, str], List[str]]
|
A tuple or list of keys representing prediction and ground truth, like: ("y_pred", "y_true"). |
required |
outputs |
str
|
The key under which to save the output. |
required |
mode |
Union[None, str, Iterable[str]]
|
What mode(s) to execute this Op in. For example, "train", "eval", "test", or "infer". To execute regardless of mode, pass None. To execute in all modes except for a particular one, you can pass an argument like "!infer" or "!train". |
'!infer'
|
ds_id |
Union[None, str, Iterable[str]]
|
What dataset id(s) to execute this Op in. To execute regardless of ds_id, pass None. To execute in all ds_ids except for a particular one, you can pass an argument like "!ds1". |
None
|
soft_dice |
bool
|
Whether to square elements in the denominator. |
False
|
average_loss |
bool
|
Whether to average the element-wise loss after the Loss Op. |
True
|
channel_average |
bool
|
Whether to average the dice score along the channel dimension. |
True
|
channel_weights |
Optional[Dict[int, float]]
|
Dictionary mapping channel indices to a weight for weighting the loss function. Useful when you need to pay more attention to a particular channel. |
None
|
epsilon |
float
|
A small value to prevent numeric instability in the division. |
1e-06
|
Returns:
Type | Description |
---|---|
The dice loss between |
|
otherwise a tensor. |
Raises:
Type | Description |
---|---|
AssertionError
|
If |