lavender99:

def dice_coeff(pred, target): smooth = 1. num = pred.size(0) m1 = pred.view(num, -1).float() # Flatten m2 = target.view(num, -1).float() # Flatten intersection = (m1 * m2).sum().float() return (2. * intersection + smooth) / (m1.sum() + m2.sum() + smooth)


thanks
i tried it works , but the value is 99 which impossible , do you have another function to measure dice similrty ?