tiramisu_brulee package

Subpackages

Submodules

tiramisu_brulee.loss module

Segmentation loss functions

See also

https://gitlab.com/shan-deep-networks/pytorch-metrics/

https://github.com/catalyst-team/catalyst/

https://github.com/facebookresearch/fvcore

S.A. Taghanaki et al. “Combo loss: Handling input and output imbalance in multi-organ segmentation.” Computerized Medical Imaging and Graphics 75 (2019): 24-33.

Author: Jacob Reinhold <jcreinhold@gmail.com> Created on: Jul 01, 2020

tiramisu_brulee.loss.binary_combo_loss(pred: torch.Tensor, target: torch.Tensor, *, reduction: str = 'mean', pos_weight: Optional[float] = None, focal_gamma: float = 0.0, combo_weight: float = 0.5) torch.Tensor[source]

combo loss (dice + focal weighted by combo_weight) for binary labels

tiramisu_brulee.loss.binary_focal_loss(pred: torch.Tensor, target: torch.Tensor, *, pos_weight: Optional[Union[float, torch.Tensor]] = None, reduction: str = 'mean', gamma: float = 2.0) torch.Tensor[source]

focal loss for binary classification or segmentation

tiramisu_brulee.loss.deeply_supervised_loss(preds: List[torch.Tensor], target: torch.Tensor, *, loss_func: Callable, level_weights: Union[float, List[float]] = 1.0, **loss_func_kwargs) torch.Tensor[source]

compute loss_func by comparing multiple same-shape preds to target

tiramisu_brulee.loss.dice_loss(pred: torch.Tensor, target: torch.Tensor, *, weight: Optional[torch.Tensor] = None, reduction: str = 'mean', eps: float = 0.001) torch.Tensor[source]

sorensen-dice coefficient loss function

tiramisu_brulee.loss.l1_segmentation_loss(pred: torch.Tensor, target: torch.Tensor, *, reduction: str = 'mean') torch.Tensor[source]

l1 loss for segmentation by applying sigmoid to pred -> l1

tiramisu_brulee.loss.mse_segmentation_loss(pred: torch.Tensor, target: torch.Tensor, *, reduction: str = 'mean') torch.Tensor[source]

mse loss for segmentation by applying sigmoid to pred -> mse

tiramisu_brulee.util module

Miscellaneous functions Author: Jacob Reinhold <jcreinhold@gmail.com> Created on: Jul 01, 2020

class tiramisu_brulee.util.InitType(value)[source]

Bases: enum.Enum

An enumeration.

HE_NORMAL = 'he_normal'
HE_UNIFORM = 'he_uniform'
NORMAL = 'normal'
ORTHOGONAL = 'orthogonal'
XAVIER_NORMAL = 'xavier_normal'
classmethod from_string(string: str) tiramisu_brulee.util.InitType[source]
tiramisu_brulee.util.init_weights(net: torch.nn.Module, *, init_type: tiramisu_brulee.util.InitType = InitType.NORMAL, gain: float = 0.02) None[source]

Module contents