dice¶

dice(gt_mask, pred_mask)[source]¶

Compute the Sørensen-Dice coefficient.

This function computes Sørensen-Dice coefficient, between the two masks.

\[DSC = 2 * |X ∩ Y| / |X| + |Y|\]
Parameters:
  • gt_mask (np.ndarray) – A binary ground truth mask

  • pred_mask (np.ndarray) – A binary predicted mask

Returns:

An estimate of Sørensen-Dice coefficient value.

Return type:

float