LION.metrics.ssim

Classes

SSIM()

SSIM, from skimage.metrics.structural_similarity, for (potentially) batched pytorch tensors.


class LION.metrics.ssim.SSIM[source]

Bases: Module

SSIM, from skimage.metrics.structural_similarity, for (potentially) batched pytorch tensors. A score: higher is better.

Initialize internal Module state, shared by both nn.Module and ScriptModule.

higher_is_better = True
forward(x, target, reduce=None, batched=True, channel_axis=None, data_range=None)[source]

The SSIM of x against target (the same shape): one per sample if batched (the first axis), or their mean if reduce is “mean”. channel_axis: the channel axis of colour images (None: grayscale, or axis 0 of a 3D sample, LION being channels-first); data_range: the range of the image values (e.g. 1 for images in [0, 1]); None: each target’s (max - min).