osc.viz.segmentation.match_segmentation_masks

match_segmentation_masks(masks, preds, preds_thres)[source]

Match predicted and ground-truth segmentation masks.

Parameters
  • masks (Tensor) – binary ground-truth masks [B T H W]

  • preds (Tensor) – float prediction masks [B S H W] for DICE matching

  • preds_thres (Tensor) – binarized prediction masks [B S H W] for IoU matching

Return type

Tuple[Tensor, Tensor, Tensor, Tensor]

Returns

Tuple of (iou_idx, iou_val, dice_idx, dice_val). IoU indexes indicate that the best match for masks[b, t] is preds_thres[b, iou_idx[b, t]] with an IoU of iou_val[b, t]. DICE indexes indicate that the best match for masks[b, t] is preds[b, dice_idx[b, t]] with a DICE score of dice_val[b, t].