bob.ip.binseg.models.losses¶
Loss implementations
Functions
Classes
|
Implements Equation 3 in [IGLOVIKOV-2018] for the hed network. |
|
Implements Equation 2 in [HE-2015]. |
|
|
|
Implements Equation 3 in [IGLOVIKOV-2018]. |
|
Implements Equation 1 in [MANINIS-2016]. |
-
class
bob.ip.binseg.models.losses.
WeightedBCELogitsLoss
(weight=None, size_average=None, reduce=None, reduction='mean', pos_weight=None)[source]¶ Bases:
torch.nn.modules.loss._Loss
Implements Equation 1 in [MANINIS-2016]. Based on
torch.nn.BCEWithLogitsLoss
.Calculate sum of weighted cross entropy loss.
-
forward
(input, target, masks=None)[source]¶ - Parameters
input (
torch.Tensor
) –target (
torch.Tensor
) –masks (
torch.Tensor
, optional) –
- Returns
- Return type
-
-
class
bob.ip.binseg.models.losses.
SoftJaccardBCELogitsLoss
(alpha=0.7, size_average=None, reduce=None, reduction='mean', pos_weight=None)[source]¶ Bases:
torch.nn.modules.loss._Loss
Implements Equation 3 in [IGLOVIKOV-2018]. Based on
torch.nn.BCEWithLogitsLoss
.-
forward
(input, target, masks=None)[source]¶ - Parameters
input (
torch.Tensor
) –target (
torch.Tensor
) –masks (
torch.Tensor
, optional) –
- Returns
- Return type
-
-
class
bob.ip.binseg.models.losses.
HEDWeightedBCELogitsLoss
(weight=None, size_average=None, reduce=None, reduction='mean', pos_weight=None)[source]¶ Bases:
torch.nn.modules.loss._Loss
Implements Equation 2 in [HE-2015]. Based on
torch.nn.modules.loss.BCEWithLogitsLoss
.Calculate sum of weighted cross entropy loss.
-
forward
(inputlist, target, masks=None)[source]¶ - Parameters
inputlist (list of
torch.Tensor
) – HED uses multiple side-output feature maps for the loss calculationtarget (
torch.Tensor
) –masks (
torch.Tensor
, optional) –
- Returns
- Return type
-
-
class
bob.ip.binseg.models.losses.
HEDSoftJaccardBCELogitsLoss
(alpha=0.3, size_average=None, reduce=None, reduction='mean', pos_weight=None)[source]¶ Bases:
torch.nn.modules.loss._Loss
Implements Equation 3 in [IGLOVIKOV-2018] for the hed network. Based on
torch.nn.BCEWithLogitsLoss
.-
forward
(inputlist, target, masks=None)[source]¶ - Parameters
input (
torch.Tensor
) –target (
torch.Tensor
) –masks (
torch.Tensor
, optional) –
- Returns
- Return type
-
-
class
bob.ip.binseg.models.losses.
MixJacLoss
(lambda_u=100, jacalpha=0.7, size_average=None, reduce=None, reduction='mean', pos_weight=None)[source]¶ Bases:
torch.nn.modules.loss._Loss
- Parameters
lambda_u (int) – determines the weighting of SoftJaccard and BCE.
-
forward
(input, target, unlabeled_input, unlabeled_traget, ramp_up_factor)[source]¶ - Parameters
input (
torch.Tensor
) –target (
torch.Tensor
) –unlabeled_input (
torch.Tensor
) –unlabeled_traget (
torch.Tensor
) –ramp_up_factor (float) –
- Returns
- Return type