MIoU#

class composer.metrics.MIoU(num_classes, ignore_index=- 1)[source]#

Torchmetrics mean Intersection-over-Union (mIoU) implementation.

IoU calculates the intersection area between the predicted class mask and the label class mask. The intersection is then divided by the area of the union of the predicted and label masks. This measures the quality of predicted class mask with respect to the label. The IoU for each class is then averaged and the final result is the mIoU score. Implementation is primarily based on mmsegmentation

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

  • ignore_index (int, optional) โ€“ the index to ignore when computing mIoU. Default: -1.

compute()[source]#

Aggregate state across all processes and compute final metric.

update(logits, targets)[source]#

Update the state with new predictions and targets.