Open notprime opened 8 months ago
@isaaccorley let me know what do you think about the "new" DiceLoss, it seems cleaner and more efficient without the burden of specyfying binary
, multilabel
and multiclass
modes.
I'm not particularly sure about line 135 and 136 in the forward
of DiceLoss, it does not make much sense to me for the two reasons I've written in the comment.
I think that we should just rewrite the losses before implementing the new ones
Overhaul of torchseg.losses, starting from DiceLoss.
General changes applied to DiceLoss (to be applied later to all other losses):
assert
towarnings
andraise
;binary
,multiclass
andmultilabels
modes when instantiating a loss function, by changing masks shape: now the shape must be [B, C, H, W] for multiclass and multilabels cases, [B, 1, H, W] for binary case. [B, 1, H, W] can be accepted also for multiclass case as long asmask_to_one_hot = True
;MEAN
,SUM
,NONE
) and definition of aLossReduction
class to easily save the techniques;Specific changes applied to DiceLoss:
power
to be applied to the denominator of the DiceCoefficient (still need to add this to the documentation of the class)