Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

Segmentation: dice losses are not computed properly when patch does not include every class. #249

Closed
Zach-ER opened this issue Oct 12, 2018 · 0 comments

Comments

@Zach-ER
Copy link
Collaborator

Zach-ER commented Oct 12, 2018

Dice losses should be evaluated as:

(dice_numerator + epsilon) / (dice_denominator + epsilon)

But currently most dice losses in niftynet are missing the epsilon in the numerator. This means that in a situation where classes are not present in the ground truth, the Dice cannot be 1 even if the prediction is perfect.

Concretely, for a two voxel problem,

predicted = tf.constant(
                [[0, 0, 1], [1, 0, 0]],
                dtype=tf.float32, name='predicted')
labels = tf.constant([2, 0], dtype=tf.int32)

The Dice score should be 1.0 (the Dice loss, 1-Score, should be 0.0).

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

No branches or pull requests

1 participant