nntoolbox.vision.losses.robust module¶
More robust loss functions (UNTESTED)
-
class
nntoolbox.vision.losses.robust.
CharbonnierLoss
(eps: float = 0.001)[source]¶ Bases:
nntoolbox.vision.losses.robust.GeneralizedCharbonnierLoss
Charbonnier Loss Function:
l(input, target) = sqrt((input - target)^2 + eps^2)
References:
Wei-Sheng Lai et al. “Fast and Accurate Image Super-Resolution with Deep Laplacian Pyramid Networks.” https://arxiv.org/pdf/1710.01992.pdf
-
training
: bool¶
-
-
class
nntoolbox.vision.losses.robust.
CharbonnierLossV2
(eps: float = 0.001)[source]¶ Bases:
torch.nn.modules.module.Module
Charbonnier Loss Function:
l(input, target) = sqrt((input - target)^2 + eps^2)
References:
Wei-Sheng Lai et al. “Fast and Accurate Image Super-Resolution with Deep Laplacian Pyramid Networks.” https://arxiv.org/pdf/1710.01992.pdf
-
forward
(input: torch.Tensor, target: torch.Tensor) → torch.Tensor[source]¶ 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¶
-
-
class
nntoolbox.vision.losses.robust.
GeneralizedCharbonnierLoss
(alpha: float = 1.0, eps: float = 1e-06)[source]¶ Bases:
torch.nn.modules.module.Module
Generalized Charbonnier Loss Function:
l(input, target) = (input - target)^2 + eps^2) ^ (alpha / 2)
References:
Deqing Sun et al. “Secrets of Optical Flow Estimation and Their Principles.” http://cs.brown.edu/~dqsun/pubs/cvpr_2010_flow.pdf
-
forward
(input: torch.Tensor, target: torch.Tensor) → torch.Tensor[source]¶ 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¶
-