ynet icon indicating copy to clipboard operation
ynet copied to clipboard

error

Open HJB555 opened this issue 2 years ago • 3 comments

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

HJB555 avatar Mar 15 '23 07:03 HJB555

I found the same error and I got 0.66 for Dice for Duke datasets fluid too.

ET06731 avatar May 07 '23 07:05 ET06731

Same doubt. Is it correct?

Deepthi-vr-code avatar Feb 12 '24 04:02 Deepthi-vr-code

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

robertleist avatar Aug 06 '24 08:08 robertleist