Custom Loss Functions

BCEFocalLossPyTorch

class BCEFocalLossPyTorch(alpha=None, gamma=2, reduction='elementwise_mean')[source]

Bases: torch.nn.Module

Focal loss for binary case without(!) logit

forward(p, t)[source]

BCEFocalLossLogitPyTorch

class BCEFocalLossLogitPyTorch(alpha=None, gamma=2, reduction='elementwise_mean')[source]

Bases: torch.nn.Module

Focal loss for binary case WITH logit

forward(p, t)[source]