Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

computation of dice #7

Open
rijobro opened this issue Nov 30, 2021 · 4 comments
Open

computation of dice #7

rijobro opened this issue Nov 30, 2021 · 4 comments

Comments

@rijobro
Copy link

rijobro commented Nov 30, 2021

Hi,

I was looking at your implementation of the dice score.

I notice that in your example notebook, the image is loaded and passed straight into compute_dice function without any pre-processing.

The input image is not one-hotted (np.unique returns [ 0. 16. 17. 18. 19. 20. 21. 22. 23. 24.]), but then is converted to a boolean (im1 = np.asarray(im1).astype(bool)). This means that you can get a dice of 1 if you correctly differentiate foreground and background, even if all labels are incorrect. Am I missing something or is this intentional?

## compute dice

true_msk_arr =  true_msk.get_fdata()
pred_msk_arr =  pred_msk.get_fdata()
wrong = pred_msk_arr.copy()
wrong[wrong > 0] = 100

dice = compute_dice(pred_msk_arr, true_msk_arr)
dice2 = compute_dice(pred_msk_arr, wrong)

print('Dice: {:.2f}'.format(dice))
print('Dice2: {:.2f}'.format(dice2))

Output:
Dice: 1.00
Dice2: 1.00

@anjany
Copy link
Owner

anjany commented Dec 2, 2021

Thank you for pointing this out. The dice should indeed be computed vertebra wise. The notebook only tells you there is a function for this. I will update the notebook to only compute the dice for one vertebra, so it is clear.

@rijobro
Copy link
Author

rijobro commented Dec 2, 2021

Thanks. So for the competition, did you do the average across all labels present in a given image? And then average this across all images in the dataset?

@anjany
Copy link
Owner

anjany commented Dec 3, 2021

Yes for both. This is what is reported in the VerSe MedIA manuscript. However, for determining the winner I adopted a pairwise-significance test to check which algorithm is better, not the average across all images.

@rijobro
Copy link
Author

rijobro commented Dec 3, 2021

Great, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants