Skip to content
Discussion options

You must be logged in to vote

@sh3rlock14 @blazejdolicki — this has been resolved by a complete API overhaul. The old Dice metric with confusing average/mdmc_average params has been replaced.

Current API (v1.9.0) — use torchmetrics.segmentation.DiceScore:

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 cla…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Borda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants