medpy icon indicating copy to clipboard operation
medpy copied to clipboard

Should Dice coefficient for empty result and empty reference be 1?

Open baumgach opened this issue 2 years ago • 0 comments

Hi there,

This issue is in reference to the following line:

https://github.com/loli/medpy/blob/39131b94f0ab5328ab14a874229320efc2f74d98/medpy/metric/binary.py#L79

Shouldn't an empty reference and an empty result set output a Dice coefficient of 1 rather than 0? I.e. if no pixels of a class are present in the image and no mask is predicted, then the prediction is correct. Or am I missing something here?

(For the Jaccard coefficient the division by 0 detection seems to be missing altogether.)

Thanks and best wishes, Christian

baumgach avatar May 24 '22 20:05 baumgach