Skip to content
Discussion options

You must be logged in to vote

@talhaanwarch @paudom @Sarmadfismael — TorchMetrics now has a dedicated segmentation module! Here's what's available (v1.9.0):

torchmetrics.segmentation:

Metric Class
Dice Score DiceScore
Mean IoU MeanIoU
Hausdorff Distance HausdorffDistance
Generalized Dice GeneralizedDiceScore
Panoptic Quality PanopticQuality

Quick example — semantic segmentation:

from torchmetrics.segmentation import DiceScore, MeanIoU

dice = DiceScore(num_classes=21, average="macro", input_format="index")
miou = MeanIoU(num_classes=21, input_format="index")

# preds: (N, H, W) — predicted class indices
# target: (N, H, W) — ground truth
dice_score = dice(preds, target)
miou_score = miou(preds, target)

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@paudom
Comment options

@Sarmadfismael
Comment options

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
Category
Q&A
Labels
None yet
5 participants