viqa.fr_metrics.rmse.RMSE

class viqa.fr_metrics.rmse.RMSE(data_range=None, normalize=False, **kwargs)[source]

Class to calculate the root mean squared error (RMSE) between two images.

score_val

RMSE score value of the last calculation.

Type:

float

parameters

Dictionary containing the parameters for RMSE calculation.

Type:

dict

Parameters:
  • data_range ({1, 255, 65535}, optional) – Data range of the returned data in data loading. Can be omitted if normalize is False. Passed to viqa.utils.load_data().

  • 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. If False, the input images are converted to grayscale images if necessary.

score(img_r, img_m)[source]

Calculate the RMSE score 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.

Returns:

score_val – RMSE score value.

Return type:

float

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:

print_score(decimals=2)[source]

Print the RMSE 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.