IoU score for Muilticlass segmentation - vision - PyTorch Forums
discuss.pytorch.org › t › iou-score-for-muilticlassJul 15, 2020 · I bit confuse how to calculate IoU score and dice for multi class segmentation, is my code valid for multi-class? def IoU_score(inputs, targets, num_classes=23, smooth=1e-5): with torch.no_grad(): #soft = nn.Softmax2d() inputs = F.softmax(inputs, dim=1) #convert into probabilites 0-1 targets = F.one_hot(targets, num_classes = n_classes).permute(0,3,1,2).contiguous()#convert target into one-hot ...