Dice#

class composer.metrics.Dice(num_classes)[source]#

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.

Parameters

num_classes (int) โ€“ the number of classes in the segmentation task.

compute()[source]#

Aggregate the state over all processes to compute the metric.

update(preds, targets)[source]#

Update the state based on new predictions and targets.