ptrblck:

Alternatively, since you are already rounding the targets to 0 and 1 to be able to use F.cross_entropy , you could also apply the same for the dice loss calculation.


Yes sir, that is what I have applied so far and it seems to work
label  = np.asarray(label)
    label = label.reshape(128, 128, 128)
    label = np.where(label > 0.5, 1, 0)

Thank you very much for following up.