viqa.fr_metrics.vsi.VSI

class viqa.fr_metrics.vsi.VSI(data_range=255, normalize=False, **kwargs)[source]

Calculate the visual saliency index (VSI) between two images.

score_val

VSI score value of the last calculation.

Type:

float

parameters

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 __call__().

  • 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.

Notes

For more information on the VSI metric, see [1].

Note

The original metric supports RGB images only. This implementation can work with grayscale images by copying the luminance channel 3 times.

References

print_score(decimals=2)[source]

Print the VSI score value of the last calculation.

Parameters:

decimals (int, default=2) – Number of decimal places to print the score value.

Warns:

RuntimeWarning – If score_val is not available.

export_results(path, filename)

Export the score to a csv file.

Parameters:
  • path (str) – The path where the csv file should be saved.

  • filename (str) – The name of the csv file.

Notes

The arguments get passed to viqa.utils.export_results().

load_images(img_r, img_m)

Load the images and perform checks.

Parameters:
  • img_r (np.ndarray, viqa.ImageArray, torch.Tensor, str or os.PathLike) – The reference image.

  • img_m (np.ndarray, viqa.ImageArray, torch.Tensor, str or os.PathLike) – The modified image.

Returns:

score(*args, **kwargs)

Calculate the score.

Deprecated since version 3.0.0: Call the metric directly instead, e.g. metric(img_m, img_r). score will be removed in the future. For full-reference metrics.