kornia.losses#

Score images, segmentations and distributions, or register images by mutual information. A loss with a target takes the prediction first; Losses and metrics tabulates the reduction defaults. Each loss function except kl_div_loss_2d() and js_div_loss_2d() has a module form.

Reconstruction

SSIM, MS-SSIM and PSNR losses, total variation, inverse-depth smoothness and the robust losses (Charbonnier, Cauchy, Geman-McClure, Welsch).

Semantic segmentation

Dice, Tversky, Lovász and focal losses on class logits, and one_hot().

Distributions

Jensen-Shannon and Kullback-Leibler divergences between probability heatmaps.

Morphology

Distance-transform and erosion-based Hausdorff losses for images and volumes.

Registration

Mutual information and normalized mutual information losses (flat signals, 2D and 3D) for image registration.