Multiple module¶
Module for functions to calculate multiple metrics.
This modules contains classes to calculate multiple metrics in batch mode or for one
Examples
>>> from viqa import BatchMetrics, MultipleMetrics, PSNR, QMeasure
>>> metrics = [PSNR(data_range=1), QMeasure(data_range=1)]
>>> metrics_parameters = [{}, {'hist_bins': 16, 'num_peaks': 2}]
>>> batch = BatchMetrics(
... file_dir='path/to/images',
... pairs_csv='path/to/pairs.csv',
... metrics=metrics,
... metrics_parameters=metrics_parameters
... )
>>> batch.calculate()
>>> batch.export_results(file_path='path/to/results', file_name='results.csv')
>>> img_r = 'path/to/reference_image'
>>> img_m = 'path/to/modified_image'
>>> multiple = MultipleMetrics(metrics, metrics_parameters)
>>> multiple.calculate(img_r, img_m)
>>> multiple.report(
... csv=True,
... metadata=True,
... text=False,
... image=False,
... file_path='path/to/results'
... )
- class viqa.multiple._MultipleInterface(metrics, metrics_parameters)[source]¶
Bases:
ABC
- export_metadata(file_path='.', file_name='metadata.txt')[source]¶
Export the metadata (custom parameters and package version) to a txt file.
- Parameters:
file_path (str) – Path to the directory where the txt file should be saved.
file_name (str, default='metadata.txt') – Name of the txt file. Default is ‘metadata.txt’.
Notes
Attention
The txt file will be overwritten if it already exists.