Skip to content

LVAE

Source

LVAE losses.

denoisplit_loss(model_outputs, targets, config, gaussian_likelihood=None, noise_model_likelihood=None)

Loss function for DenoiSplit.

Parameters:

  • model_outputs (tuple[Tensor, dict[str, Any]]) –

    Tuple containing the model predictions (shape is (B, target_ch, [Z], Y, X)) and the top-down layer data (e.g., sampled latents, KL-loss values, etc.).

  • targets (Tensor) –

    The target image used to compute the reconstruction loss. Shape is (B, target_ch, [Z], Y, X).

  • config (LVAELossConfig) –

    The config for loss function containing all loss hyperparameters.

  • gaussian_likelihood (GaussianLikelihood, default: None ) –

    The Gaussian likelihood object.

  • noise_model_likelihood (NoiseModelLikelihood, default: None ) –

    The noise model likelihood object.

Returns:

  • output ( Optional[dict[str, Tensor]] ) –

    A dictionary containing the overall loss ["loss"], the reconstruction loss ["reconstruction_loss"], and the KL divergence loss ["kl_loss"].

denoisplit_musplit_loss(model_outputs, targets, config, gaussian_likelihood, noise_model_likelihood)

Loss function for DenoiSplit.

Parameters:

  • model_outputs (tuple[Tensor, dict[str, Any]]) –

    Tuple containing the model predictions (shape is (B, target_ch, [Z], Y, X)) and the top-down layer data (e.g., sampled latents, KL-loss values, etc.).

  • targets (Tensor) –

    The target image used to compute the reconstruction loss. Shape is (B, target_ch, [Z], Y, X).

  • config (LVAELossConfig) –

    The config for loss function containing all loss hyperparameters.

  • gaussian_likelihood (GaussianLikelihood) –

    The Gaussian likelihood object.

  • noise_model_likelihood (NoiseModelLikelihood) –

    The noise model likelihood object.

Returns:

  • output ( Optional[dict[str, Tensor]] ) –

    A dictionary containing the overall loss ["loss"], the reconstruction loss ["reconstruction_loss"], and the KL divergence loss ["kl_loss"].

hdn_loss(model_outputs, targets, config, gaussian_likelihood, noise_model_likelihood)

Loss function for HDN.

Parameters:

  • model_outputs (tuple[Tensor, dict[str, Any]]) –

    Tuple containing the model predictions (shape is (B, target_ch, [Z], Y, X)) and the top-down layer data (e.g., sampled latents, KL-loss values, etc.).

  • 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, target_ch, [Z], Y, X).

  • config (LVAELossConfig) –

    The config for loss function containing all loss hyperparameters.

  • gaussian_likelihood (GaussianLikelihood) –

    The Gaussian likelihood object.

  • noise_model_likelihood (NoiseModelLikelihood) –

    The noise model likelihood object.

Returns:

  • output ( Optional[dict[str, Tensor]] ) –

    A dictionary containing the overall loss ["loss"], the reconstruction loss ["reconstruction_loss"], and the KL divergence loss ["kl_loss"].

musplit_loss(model_outputs, targets, config, gaussian_likelihood, noise_model_likelihood=None)

Loss function for muSplit.

Parameters:

  • model_outputs (tuple[Tensor, dict[str, Any]]) –

    Tuple containing the model predictions (shape is (B, target_ch, [Z], Y, X)) and the top-down layer data (e.g., sampled latents, KL-loss values, etc.).

  • targets (Tensor) –

    The target image used to compute the reconstruction loss. Shape is (B, target_ch, [Z], Y, X).

  • config (LVAELossConfig) –

    The config for loss function (e.g., KL hyperparameters, likelihood module, noise model, etc.).

  • gaussian_likelihood (GaussianLikelihood) –

    The Gaussian likelihood object.

  • noise_model_likelihood (Optional[NoiseModelLikelihood], default: None ) –

    The noise model likelihood object. Not used here.

Returns:

  • output ( Optional[dict[str, Tensor]] ) –

    A dictionary containing the overall loss ["loss"], the reconstruction loss ["reconstruction_loss"], and the KL divergence loss ["kl_loss"].