Dictionary containing the parameters for VSI 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 VSI 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.
Raises:
ValueError – If data_range is not set.
Warning
This metric is not yet tested. The metric should be only used for experimental
purposes.
Calculate the visual saliency index (VSI) between two images.
The metric can be calculated for 2D and 3D images. If the images are 3D, the
metric can be calculated for the full volume or for a given slice of the image
by setting dim to the desired dimension and im_slice to the desired
slice number.
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) – VSI for 3D images is calculated as mean over all slices of the given
dimension.
im_slice (int, optional) – If given, VSI is calculated only for the given slice of the 3D image.
**kwargs (optional) – Additional parameters for VSI calculation. The keyword arguments are passed
to piq.vsi(). See the documentation under [2].
reduction (str, default='mean') – Specifies the reduction type: ‘none’, ‘mean’ or ‘sum’.
c1 (float, default=1.27) – Coefficient to calculate saliency component. See [3].
c2 (float, default=386.0) – Coefficient to calculate gradient component. See [3].
c3 (float, default=130.0) – Coefficient to calculate color component. See [3].
alpha (float, default=0.4) – Power for gradient component.
beta (float, default=0.02) – Power for color component.
omega_0 (float, default=0.021) – Coefficient to get log Gabor filter with SDSP. See [4].
sigma_f (float, default=1.34) – Coefficient to get log Gabor filter with SDSP. See [4].
sigma_d (float, default=145.0) – Coefficient to get SDSP. See [4].
sigma_c (float, default=0.001) – Coefficient to get SDSP. See [4].
Returns:
score_val – VSI score value.
Return type:
float
Raises:
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, VSI is
calculated for the full volume.
Notes
For 3D images if dim is given, but im_slice is not, the VSI is
calculated for the full volume of the 3D image. This is implemented as mean of
the VSI values of all slices of the given dimension. If dim is given and
im_slice is given, the VSI is calculated for the given slice of the given
dimension (represents a 2D metric of the given slice).