You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When gt and pd are exactly the same and filled with the same value val, compute_dice returns NaN for the classes that are not the value val. This is due to the resulting zero division at the line: dice = 2 * np.logical_and(pd, gt).sum() / (pd.sum() + gt.sum()). I believe it should return 1.0 since gt and pd are still exactly the same.
I wrote this up to demonstrate this and included a possible fix.
The text was updated successfully, but these errors were encountered:
emmanuel-nwogu
changed the title
[Possible bug] compute_dice() in detailed_validationreturns NaN when ground truth and prediction are the same
[Possible bug] compute_dice() in detailed_validation returns NaN when ground truth and prediction are the same
May 11, 2023
When
gt
andpd
are exactly the same and filled with the same valueval
, compute_dice returns NaN for the classes that are not the valueval
. This is due to the resulting zero division at the line:dice = 2 * np.logical_and(pd, gt).sum() / (pd.sum() + gt.sum())
. I believe it should return 1.0 sincegt
andpd
are still exactly the same.I wrote this up to demonstrate this and included a possible fix.
The text was updated successfully, but these errors were encountered: