Criterion¶
This module contains loss functions.
-
tensornet.models.loss.
cross_entropy_loss
()[source]¶ Cross Entropy Loss. The loss automatically applies the softmax activation function on the prediction input.
- Returns
Cross entroy loss function
-
tensornet.models.loss.
bce_loss
()[source]¶ Binary Cross Entropy Loss. The loss automatically applies the sigmoid activation function on the prediction input.
- Returns
Binary cross entropy loss function
-
tensornet.models.loss.
mse_loss
()[source]¶ Mean Squared Error Loss.
- Returns
Mean squared error loss function
-
tensornet.models.loss.
rmse_loss
(smooth=1e-06)[source]¶ Root Mean Squared Error Loss.
- Returns
Root mean squared error loss function
-
tensornet.models.loss.
dice_loss
(smooth=1)[source]¶ Dice Loss.
- Parameters
smooth (
float
, optional) – Smoothing value. A larger smooth value (also known as Laplace smooth, or Additive smooth) can be used to avoid overfitting. (default: 1)- Returns
Dice loss function
-
tensornet.models.loss.
bce_dice_loss
(smooth=1e-06)[source]¶ BCE Dice Loss.
- Parameters
smooth (
float
, optional) – Smoothing value.- Returns
BCE Dice loss function
-
tensornet.models.loss.
ssim_loss
(data_range=1.0, size_average=True, channel=1)[source]¶ SSIM Loss.
- Parameters
data_range (
float
orint
, optional) – Value range of input images (usually 1.0 or 255). (default: 255)size_average (
bool
, optional) – If size_average=True, ssim of all images will be averaged as a scalar. (default: True)channel (
int
, optional) – input channels (default: 1)
- Returns
SSIM loss function
-
tensornet.models.loss.
ms_ssim_loss
(data_range=1.0, size_average=True, channel=1)[source]¶ MS-SSIM Loss.
- Parameters
data_range (
float
orint
, optional) – Value range of input images (usually 1.0 or 255). (default: 1.0)size_average (
bool
, optional) – If size_average=True, ssim of all images will be averaged as a scalar. (default: True)channel (
int
, optional) – input channels (default: 1)
- Returns
MS-SSIM loss function