Dice Metric args are unclear #1458
|
Hi there! but at row 166 we have: I was also wondering if your Dice support the Thanks in advance for your help 🙏🏻 ! |
Replies: 2 comments
|
I also stumbled upon the same issue, I think this is a bug in the library, see my comment: #1425 (comment) |
|
@sh3rlock14 @blazejdolicki — this has been resolved by a complete API overhaul. The old Current API (v1.9.0) — use from torchmetrics.segmentation import DiceScore
# For 3D volume segmentation (N, C, D, H, W) one-hot format:
dice = DiceScore(
num_classes=5,
average="macro", # "micro", "macro", "weighted", "none"
input_format="one-hot", # expects (N, C, ...) one-hot encoded
include_background=False, # skip background class
per_class=False, # True to get per-class scores
)
score = dice(preds, target)For multi-label / overlapping classes (multiple "1"s along channel dim): dice = DiceScore(
num_classes=C,
average="none",
input_format="one-hot",
include_background=False,
)
per_class_dice = dice(preds.long(), target.long())The old Docs: DiceScore |
@sh3rlock14 @blazejdolicki — this has been resolved by a complete API overhaul. The old
Dicemetric with confusingaverage/mdmc_averageparams has been replaced.Current API (v1.9.0) — use
torchmetrics.segmentation.DiceScore:For multi-label / overlapping cla…