However this is still a measure of similarity, I don’t see how to maximise this term concurrently with the cross entropy loss, if it was the real dice I would have done this:
ce(output, target) + (1-dice(output, target))