open3d.ml.torch.modules.losses.FocalLoss#
- class open3d.ml.torch.modules.losses.FocalLoss(gamma=2.0, alpha=0.25, loss_weight=1.0)#
-
- Parameters:
gamma (float, optional) – The gamma for calculating the modulating factor. Defaults to 2.0.
alpha (float, optional) – A balanced form for Focal Loss. Defaults to 0.25.
loss_weight (float, optional) – Weight of loss. Defaults to 1.0.
- __init__(gamma=2.0, alpha=0.25, loss_weight=1.0)#
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(pred, target, weight=None, avg_factor=None)#
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool#