mipcandy.metrics#
Module Contents#
Functions#
|
|
|
|
|
API#
- mipcandy.metrics._args_check(outputs: torch.Tensor, labels: torch.Tensor, *, dtype: torch.dtype | None = None, device: mipcandy.types.Device | None = None) tuple[torch.dtype, mipcandy.types.Device][source]#
- mipcandy.metrics.do_reduction(x: torch.Tensor, method: mipcandy.types.Reduction) torch.Tensor[source]#
- mipcandy.metrics.binary_dice(outputs: torch.Tensor, labels: torch.Tensor, *, if_empty: float = 1, reduction: mipcandy.types.Reduction = 'mean') torch.Tensor[source]#
- Parameters:
outputs – boolean class ids (B, 1, …)
labels – boolean class ids (B, 1, …)
if_empty – the value to return if both outputs and labels are empty
reduction – the reduction method to apply to the dice score
- mipcandy.metrics.dice_similarity_coefficient(outputs: torch.Tensor, labels: torch.Tensor, *, if_empty: float = 1, reduction: mipcandy.types.Reduction = 'mean') torch.Tensor[source]#
- Parameters:
outputs – one-hot (B, N, …)
labels – one-hot (B, N, …)
if_empty – the value to return if both outputs and labels are empty
reduction – the reduction method to apply to the dice score
- mipcandy.metrics.soft_dice(outputs: torch.Tensor, labels: torch.Tensor, *, smooth: float = 1, batch_dice: bool = True, reduction: mipcandy.types.Reduction = 'mean') torch.Tensor[source]#
- Parameters:
outputs – logits (B, C, …)
labels – logits (B, C, …)
smooth – the smoothness term to avoid division by zero
batch_dice – whether to compute dice score for each batch separately
reduction – the reduction method to apply to the dice score