Skip to content

Commit

Permalink
adapt dice score for empty gt mask
Browse files Browse the repository at this point in the history
  • Loading branch information
wasserth committed Feb 6, 2024
1 parent deafa2d commit 350bb89
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/test_end_to_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@


def dice_score(y_true, y_pred):
if y_true.sum() == 0 and y_pred.sum() == 0:
return 1.0
intersect = np.sum(y_true * y_pred)
denominator = np.sum(y_true) + np.sum(y_pred)
f1 = (2 * intersect) / (denominator + 1e-6)
Expand Down

0 comments on commit 350bb89

Please sign in to comment.