meddlr.metrics.functional.ssim#
- meddlr.metrics.functional.ssim(pred: Tensor, target: Tensor, method: Optional[str] = None, kernel_size=11, sigma=1.5, data_range=None, k1=0.01, k2=0.03, pad_mode: str = 'reflect', im_type: str = 'magnitude') Tensor[source]#
Computes structural similarity index (SSIM).
- Parameters
pred (torch.Tensor) – The prediction. Either a complex or real tensor.
target (torch.Tensor) – The target. Either a complex or real tensor.
im_type (str, optional) – The image type to compute metric on. This only applies for complex inputs, otherwise ignored. Either
'magnitude'(default) to compute metric on magnitude images or'phase'to compute metric on phase/angle images. IfNone, computed on complex images.
- Returns
The SSIM for each (batch, channel) pair.
- Return type
torch.Tensor