You’re welcome, I just encountered your comment here 6, so I understand the problem better, didn’t kow about dice loss before.
some remarks on dice loss : at the very best, maximum is reached when output = target, which means
dice = 2* ((target**2)/(target**2 + target))
target is only composed of 0s and 1s, so target **2 is equal to target which brings us to dice = 1
at the very worst, output*target is 0 and dice is 0.
are you sure output has it’s values between 0 and 1 ? I see output.exp() , shouldn’t it be torch.nn.functional.softmax(output) ? (maybe your output has been logsoftmaxed before though…)