shell = dilate(target) & ~erode(target) loss = ( dice_loss + bce_loss + 0.5 * bce_loss_on(shell) )