metrics
DiceScore
Bases: CatMetric
torch.nn.Module for dice loss (given by
:math:D(p, t) = \frac{2|pt|+s}{|p|+|t|+s}) computation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
smooth |
float
|
smooth value for dice score. |
1
|
reduction |
str
|
reduction method for computed dice scores. Can be one of "mean", "sum" or "none". |
'mean'
|
dice_score(input, target, smooth=1, reduction='mean')
Computes dice score (given by :math:D(p, t) = \frac{2|pt|+s}{|p|+|t|+s}) between
predicted input tensor and target ground truth.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input |
torch.Tensor
|
predicted input tensor of shape (N, ...). |
required |
target |
torch.Tensor
|
target ground truth tensor of shape (N, ...). |
required |
smooth |
float
|
smooth value for dice score. |
1
|
reduction |
str
|
reduction method for computed dice scores. Can be one of "mean", "sum" or "none". |
'mean'
|
Returns:
| Type | Description |
|---|---|
torch.Tensor
|
Computed dice score, optionally reduced using specified reduction method. |