fit_a_nef.metrics.ssim

fit_a_nef.metrics.ssim(a: ~jax.Array, b: ~jax.Array, max_val: float = 1.0, filter_size: int = 11, filter_sigma: float = 1.5, k1: float = 0.01, k2: float = 0.03, return_map: bool = False, precision=<Precision.HIGHEST: 2>, filter_fn: ~typing.Callable[[~jax.Array], ~jax.Array] | None = None) Array

Vectorized version of ssim. Takes similar arguments as ssim but with additional array axes over which ssim is mapped.

Original documentation:

Computes the structural similarity index (SSIM) between image pairs.

This function is based on the standard SSIM implementation from: Z. Wang, A. C. Bovik, H. R. Sheikh and E. P. Simoncelli, “Image quality assessment: from error visibility to structural similarity”, in IEEE Transactions on Image Processing, vol. 13, no. 4, pp. 600-612, 2004.

This function was modeled after tf.image.ssim, and should produce comparable output.

Note: the true SSIM is only defined on grayscale. This function does not perform any colorspace transform. If the input is in a color space, then it will compute the average SSIM.

param a:

First image (or set of images).

type a:

jax.Array

param b:

Second image (or set of images).

type b:

jax.Array

param max_val:

The maximum magnitude that a or b can have.

type max_val:

float

param filter_size:

Window size (>= 1). Image dims must be at least this small.

type filter_size:

int

param filter_sigma:

The bandwidth of the Gaussian used for filtering (> 0.).

type filter_sigma:

float

param k1:

One of the SSIM dampening parameters (> 0.).

type k1:

float

param k2:

One of the SSIM dampening parameters (> 0.).

type k2:

float

param return_map:

If True, will cause the per-pixel SSIM “map” to be returned.

type return_map:

bool

param precision:

The numerical precision to use when performing convolution.

type precision:

jax.lax.Precision

param filter_fn:

An optional argument for overriding the filter function used by SSIM, which would otherwise be a 2D Gaussian blur specified by filter_size and filter_sigma.

type filter_fn:

Optional[Callable[[jax.Array], jax.Array]]

return:

Each image’s mean SSIM, or a tensor of individual values if return_map.

rtype:

jax.Array