mipcandy.common.optim.loss#

Module Contents#

Classes#

API#

class mipcandy.common.optim.loss.FocalBCEWithLogits(alpha: float, gamma: float, *, reduction: Literal[mean, sum, none] = 'mean')[source]#

Bases: torch.nn.Module

forward(logits: torch.Tensor, targets: torch.Tensor) torch.Tensor[source]#
class mipcandy.common.optim.loss.Loss[source]#

Bases: torch.nn.Module

property validation_mode: bool#
class mipcandy.common.optim.loss.SegmentationLoss(num_classes: int, include_background: bool)[source]#

Bases: mipcandy.common.optim.loss.Loss

logitfy_no_grad(ids: torch.Tensor) torch.Tensor[source]#
class mipcandy.common.optim.loss.DiceCELossWithLogits(num_classes: int, *, lambda_ce: float = 1, lambda_soft_dice: float = 1, smooth: float = 1e-05, include_background: bool = True)[source]#

Bases: mipcandy.common.optim.loss.SegmentationLoss

_forward(outputs: torch.Tensor, labels: torch.Tensor) tuple[torch.Tensor, dict[str, float]][source]#
forward(outputs: torch.Tensor, labels: torch.Tensor) tuple[torch.Tensor, dict[str, float]][source]#
class mipcandy.common.optim.loss.DiceBCELossWithLogits(*, lambda_bce: float = 1, lambda_soft_dice: float = 1, smooth: float = 1e-05, min_percentage_per_class: float | None = None)[source]#

Bases: mipcandy.common.optim.loss.SegmentationLoss

_forward(outputs: torch.Tensor, labels: torch.Tensor) tuple[torch.Tensor, dict[str, float]][source]#
forward(outputs: torch.Tensor, labels: torch.Tensor) tuple[torch.Tensor, dict[str, float]][source]#