Dice

class composer.models.loss.Dice(nclass)[source]

Bases: torchmetrics.metric.Metric

The Dice Coefficient for evaluating image segmentation.

The Dice Coefficient measures how similar predictions and targets are. More concretely, it is computed as 2 * the Area of Overlap divided by the total number of pixels in both images.

compute()[source]

Aggregate the state over all processes to compute the metric.

update(pred, target)[source]

Update the state based on new predictions and targets.