liom_toolkit.segmentation.vseg.loss module

class liom_toolkit.segmentation.vseg.loss.DiceBCELoss

Bases: Module

Dice + BCE loss function

forward(inputs: Tensor, targets: Tensor, smooth: int = 1) Tensor

Calculate the Dice + BCE loss

Parameters:
  • inputs (torch.Tensor) – input tensor

  • targets (torch.Tensor) – target tensor

  • smooth (int) – smoothing factor

Returns:

Dice + BCE loss

Return type:

torch.Tensor

class liom_toolkit.segmentation.vseg.loss.DiceLoss

Bases: Module

Dice loss function

forward(inputs: Tensor, targets: Tensor, smooth: int = 1) Tensor

Calculate the Dice loss

Parameters:
  • inputs (torch.Tensor) – input tensor

  • targets (torch.Tensor) – target tensor

  • smooth (int) – smoothing factor

Returns:

Dice loss

Return type:

torch.Tensor