LION.metrics.psnr

Classes

PSNR()

PSNR, from skimage.metrics.peak_signal_noise_ratio, for (potentially) batched pytorch tensors.


class LION.metrics.psnr.PSNR[source]

Bases: Module

PSNR, from skimage.metrics.peak_signal_noise_ratio, 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, data_range=None)[source]

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