question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

more dice score definition

See original GitHub issue

Subject of the feature

For the dice, the current definition is https://github.com/DeepRegNet/DeepReg/blob/main/deepreg/model/loss/label.py#L149. It corresponds to the definition in https://arxiv.org/abs/1707.03237. But in https://arxiv.org/abs/1606.04797, the terms in the denominator are squared.

Two forms are identical in the binary case as the square of 1 is 1. But when y_true and y_pred are probabilities. As far as I know, there’s no closed-form. Both formulations are an approximation.

In https://en.wikipedia.org/wiki/Sørensen–Dice_coefficient, dice score is defined as 2TP/(2TP+FP+FN). If we consider N i.i.d. voxel with y_true=p, which means with 100*p%, the voxel is foreground. Similarly, let y_pred=q. Then we expect TP=pq*N, FP=(1-p)q*N, FN=p(1-q)*N. This gives the non-squared version.

Therefore it could be nice to provide the square option in case anyone wants it. No need to change the default definition.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
tvercautcommented, Nov 18, 2020

There is no bullet-proof answer to the question of how to implement the soft Dice for deep learning purposes. Different justification lead to different choices (square, non-square, what epsilons and where, foreground only or average between foreground and background dice, how to handle multi-classes, batch version, etc.). Many of the issues arise when you have ground truth with 0 foreground voxels. At least in our experience, the batch version of the soft Dice really helps the training.

If you are interested in that rabbit hole, here are some pointers: https://github.com/Project-MONAI/MONAI/issues/807 https://arxiv.org/abs/1707.00478 Section 3.6.1 in https://mediatum.ub.tum.de/doc/1395260/1395260.pdf

0reactions
YipengHucommented, Jan 20, 2021

EDIT: a new ticket may be better - sorry

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is the Dice coefficient the same as accuracy? - Cross Validated
The Dice score is not only a measure of how many positives you find, but it also penalizes for the false positives that...
Read more >
Sørensen–Dice coefficient - Wikipedia
The Sørensen–Dice coefficient is a statistic used to gauge the similarity of two samples. It was independently developed by the botanists Thorvald Sørensen ......
Read more >
Understanding DICE COEFFICIENT - Kaggle
The Dice coefficient is defined to be 1 when both X and Y are empty. The leaderboard score is the mean of the...
Read more >
Dice similarity coefficient | Radiology Reference Article
... Dice coefficient, is a statistical tool which measures the similarity between two sets of data. This index has become arguably the most ......
Read more >
Dice score visualization. The Dice score is used to gauge ...
Dice score visualization. The Dice score is used to gauge model performance, ranging from 0 to 1. 1 corresponds to a pixel perfect...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found