torchmetrics icon indicating copy to clipboard operation
torchmetrics copied to clipboard

Dice metric cannot compute DICE score for each class

Open NguyenAnhTien opened this issue 2 years ago • 5 comments

🐛 Bug

The class DICE (in the dice.py), at the line 176, the condition

if average not in ["micro", "macro", "samples"]

doest not work with the documents. This condition does not allow 'none' (None) value for the class DICE. Therefore, this class cannot produce DICE for each class.

NguyenAnhTien avatar Dec 25 '23 22:12 NguyenAnhTien

Hi! thanks for your contribution!, great first issue!

github-actions[bot] avatar Dec 25 '23 22:12 github-actions[bot]

I guess you are referring to the master branch, right? Pls add a link to the code; that would be easier... :flamingo:

Borda avatar Dec 27 '23 09:12 Borda

I have the same problem, I can't get a per-class Dice score when providing an average argument of None:

https://github.com/Lightning-AI/torchmetrics/blob/7e2ebff476d4faa56a5eb526732a880df40e7bb8/src/torchmetrics/classification/dice.py#L177

ManuelZ avatar Feb 19 '24 18:02 ManuelZ

Duplicate issue: https://github.com/Lightning-AI/torchmetrics/issues/1602

asbjrnmunk avatar Mar 14 '24 09:03 asbjrnmunk