Losses
Losses module.
denoisplit_loss(model_outputs, targets, config, gaussian_likelihood=None, noise_model_likelihood=None)
Loss function for DenoiSplit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_outputs
|
tuple[Tensor, dict[str, Any]]
|
Tuple containing the model predictions (shape is (B, |
required |
targets
|
Tensor
|
The target image used to compute the reconstruction loss. Shape is
(B, |
required |
config
|
LVAELossConfig
|
The config for loss function containing all loss hyperparameters. |
required |
gaussian_likelihood
|
GaussianLikelihood
|
The Gaussian likelihood object. |
None
|
noise_model_likelihood
|
NoiseModelLikelihood
|
The noise model likelihood object. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
output |
Optional[dict[str, Tensor]]
|
A dictionary containing the overall loss |
denoisplit_musplit_loss(model_outputs, targets, config, gaussian_likelihood, noise_model_likelihood)
Loss function for DenoiSplit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_outputs
|
tuple[Tensor, dict[str, Any]]
|
Tuple containing the model predictions (shape is (B, |
required |
targets
|
Tensor
|
The target image used to compute the reconstruction loss. Shape is
(B, |
required |
config
|
LVAELossConfig
|
The config for loss function containing all loss hyperparameters. |
required |
gaussian_likelihood
|
GaussianLikelihood
|
The Gaussian likelihood object. |
required |
noise_model_likelihood
|
NoiseModelLikelihood
|
The noise model likelihood object. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
output |
Optional[dict[str, Tensor]]
|
A dictionary containing the overall loss |
hdn_loss(model_outputs, targets, config, gaussian_likelihood, noise_model_likelihood)
Loss function for HDN.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_outputs
|
tuple[Tensor, dict[str, Any]]
|
Tuple containing the model predictions (shape is (B, |
required |
targets
|
Tensor
|
The target image used to compute the reconstruction loss. In this case we use
the input patch itself as target. Shape is (B, |
required |
config
|
LVAELossConfig
|
The config for loss function containing all loss hyperparameters. |
required |
gaussian_likelihood
|
GaussianLikelihood
|
The Gaussian likelihood object. |
required |
noise_model_likelihood
|
NoiseModelLikelihood
|
The noise model likelihood object. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
output |
Optional[dict[str, Tensor]]
|
A dictionary containing the overall loss |
mae_loss(samples, labels, *args)
N2N Loss function described in to J Lehtinen et al 2018.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
samples
|
Tensor
|
Raw patches. |
required |
labels
|
Tensor
|
Different subset of noisy patches. |
required |
*args
|
Any
|
Additional arguments. |
()
|
Returns:
| Type | Description |
|---|---|
Tensor
|
Loss value. |
mse_loss(source, target, *args)
Mean squared error loss.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Tensor
|
Source patches. |
required |
target
|
Tensor
|
Target patches. |
required |
*args
|
Any
|
Additional arguments. |
()
|
Returns:
| Type | Description |
|---|---|
Tensor
|
Loss value. |
musplit_loss(model_outputs, targets, config, gaussian_likelihood, noise_model_likelihood=None)
Loss function for muSplit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_outputs
|
tuple[Tensor, dict[str, Any]]
|
Tuple containing the model predictions (shape is (B, |
required |
targets
|
Tensor
|
The target image used to compute the reconstruction loss. Shape is
(B, |
required |
config
|
LVAELossConfig
|
The config for loss function (e.g., KL hyperparameters, likelihood module, noise model, etc.). |
required |
gaussian_likelihood
|
GaussianLikelihood
|
The Gaussian likelihood object. |
required |
noise_model_likelihood
|
Optional[NoiseModelLikelihood]
|
The noise model likelihood object. Not used here. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
output |
Optional[dict[str, Tensor]]
|
A dictionary containing the overall loss |
n2v_loss(manipulated_batch, original_batch, masks, *args)
N2V Loss function described in A Krull et al 2018.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manipulated_batch
|
Tensor
|
Batch after manipulation function applied. |
required |
original_batch
|
Tensor
|
Original images. |
required |
masks
|
Tensor
|
Coordinates of changed pixels. |
required |
*args
|
Any
|
Additional arguments. |
()
|
Returns:
| Type | Description |
|---|---|
Tensor
|
Loss value. |