dival.util.torch_losses module

Provides custom loss functions for PyTorch.

dival.util.torch_losses.tv_loss(x)[source]

Anisotropic TV loss similar to the one in [1].

Parameters:

x (torch.Tensor) – Tensor of which to compute the anisotropic TV w.r.t. its last two axes.

References

dival.util.torch_losses.poisson_loss(y_pred, y_true, photons_per_pixel=4096, mu_max=81.35858)[source]

Loss corresponding to Poisson regression (cf. [2]) for post-log CT data. The default parameters are based on the LoDoPaB dataset creation (cf. [3]).

Authors:

Sören Dittmer <sdittmer@math.uni-bremen.de>

Parameters:
  • y_pred (torch.Tensor) – Predicted observation (post-log, normalized by mu_max). Each entry specifies the mean of a Poisson distribution, with respect to which the likelihood of the observation y_true is considered.

  • y_true (torch.Tensor) – True observation (post-log, normalized by mu_max).

  • photons_per_pixel (int or float, optional) – Mean number of photons per detector pixel for an unattenuated beam. Default: 4096.

  • mu_max (float, optional) – Normalization factor, by which y_pred and y_true have been divided (this function will multiply by it accordingly). Default: dival.util.constants.MU_MAX.

References