error
Hello, there may be some errors in your code about Y-Net. When calculating the Dice of the fluid, if there is no truth value and prediction image, the Dice calculated by your code is 2. By correcting your code, I got 0.66 for Dice for Duke datasets fluid. def per_class_dice(y_pred, y_true, num_class): avg_dice = 0 y_pred = y_pred.data.squeeze() #.cpu().numpy() y_true = y_true.data.squeeze() #.cpu().numpy() dice_all = np.zeros(num_class) for i in range(num_class): GT = y_true[:,:,i].view(-1) Pred = y_pred[:,:,i].view(-1) #print(GT.shape, Pred.shape) inter = (GT * Pred).sum() + 0.0001 union = GT.sum() + Pred.sum() + 0.0001 t = 2 * inter / union avg_dice = avg_dice + (t / num_class) dice_all[i] = t return avg_dice, dice_all
I found the same error and I got 0.66 for Dice for Duke datasets fluid too.
Same doubt. Is it correct?
This is definitely an error and leads to false average Dice scores for the validation and test. Dice loss, however, should be computed correctly. Check out my pull request for a fix: https://github.com/azadef/ynet/pull/6