Dictionary containing the parameters for MS-SSIM calculation.
Type:
dict
Parameters:
data_range ({1, 255, 65535}, default=255) – Data range of the returned data in data loading. Is used for image loading when
normalize is True and for the MS-SSIM calculation. Passed to
viqa.utils.load_data() and score().
normalize (bool, default=False) – If True, the input images are normalized to the data_range argument.
**kwargs (optional) – Additional parameters for data loading. The keyword arguments are passed to
viqa.utils.load_data().
chromatic (bool, default False) –
If True, the input images are expected to be RGB images.
Note
Color images can be used, but it is unclear how the called implementation
piq.multi_scale_ssim() handles the color channels.
Raises:
ValueError – If data_range is not set.
Warning
This metric is not yet tested. The metric should be only used for experimental
purposes.
Notes
For more information on the MS-SSIM metric, see [1].
Calculate the multiscale structural similarity index (MS-SSIM) between two
images.
Parameters:
img_r (np.ndarray or Tensor or str or os.PathLike) – Reference image to calculate score against.
img_m (np.ndarray or Tensor or str or os.PathLike) – Distorted image to calculate score of.
dim ({0, 1, 2}, optional) – MS-SSIM for 3D images is calculated as mean over all slices of the given
dimension.
im_slice (int, optional) – If given, MS-SSIM is calculated only for the given slice of the 3D image.
**kwargs (optional) – Additional parameters for MS-SSIM calculation. The keyword arguments are
passed to piq.multi_scale_ssim(). See the documentation under [2].
kernel_size (int, default=11) – The side-length of the sliding window used in comparison. Must be an odd
value.
kernel_sigma (float, default=1.5) – Sigma of normal distribution.
reduction (str, default='mean') – Specifies the reduction type: ‘none’, ‘mean’ or ‘sum’.
scale_weights (list, default=[0.0448, 0.2856, 0.3001, 0.2363, 0.1333]) – Weights for different scales.
k2 (float, default=0.03) – Algorithm parameter, K2 (small constant, see [3]).
Try a larger K2 constant (e.g. 0.4) if you get a negative or NaN
results.
ValueError – If invalid dimension given in dim.
If images are neither 2D nor 3D.
If images are 3D, but dim is not given.
If im_slice is given, but not an integer.
Warns:
RuntimeWarning – If dim or im_slice is given for 2D images.
If im_slice is not given, but dim is given for 3D images, MS-SSIM is
calculated for the full volume.
Notes
For 3D images if dim is given, but im_slice is not, the MS-SSIM is
calculated for the full volume of the 3D image. This is implemented as mean of
the MS-SSIM values of all slices of the given dimension. If dim is given and
im_slice is given, the MS-SSIM is calculated for the given slice of the
given dimension (represents a 2D metric of the given slice).