Internal Metrics module

Module for the internal metrics classes.

This module contains the abstract classes for the metrics.

class viqa._metrics.Metric(data_range, normalize, **kwargs)[source]
abstract score(*args)[source]

Calculate the score.

abstract print_score(*args)[source]

Print the score.

export_results(path, filename)[source]

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

class viqa._metrics.FullReferenceMetricsInterface(data_range, normalize, **kwargs)[source]

Bases: ABC, Metric

__init__(data_range, normalize, **kwargs)[source]
load_images(img_r, img_m)[source]

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:

__eq__(other)

Return self==value.

__ge__(other)

Return self>=value.

__gt__(other)

Return self>value.

__le__(other)

Return self<=value.

__lt__(other)

Return self<value.

__ne__(other)

Return self!=value.

__repr__()

Return repr(self).

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

abstract print_score(*args)

Print the score.

abstract score(*args)

Calculate the score.

class viqa._metrics.NoReferenceMetricsInterface(data_range, normalize, **kwargs)[source]

Bases: ABC, Metric

__init__(data_range, normalize, **kwargs)[source]
load_images(img)[source]

Load the image.

Uses the viqa.utils.load_data() function to load the image.

Parameters:

img (np.ndarray, viqa.ImageArray, torch.Tensor, str or os.PathLike) – The image to load.

Returns:

img – The loaded image as an viqa.utils.ImageArray.

Return type:

viqa.ImageArray

__eq__(other)

Return self==value.

__ge__(other)

Return self>=value.

__gt__(other)

Return self>value.

__le__(other)

Return self<=value.

__lt__(other)

Return self<value.

__ne__(other)

Return self!=value.

__repr__()

Return repr(self).

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

abstract print_score(*args)

Print the score.

abstract score(*args)

Calculate the score.