test_metrics#

from pssr.predict import test_metrics
pssr.predict.test_metrics(model: Module, dataset: Dataset, device: str = 'cpu', metrics: list[str] = ['mse', 'pixel', 'psnr', 'ssim'], avg: bool = True, norm: bool = True, callbacks=None)#

Computes image restoration metrics of predicted vs ground truth images.

Only uses evaluation images if applicable. Set val_split=1 in dataset to use all images.

Parameters:
  • model (nn.Module) – Model to recieve low-resolution images.

  • dataset (Dataset) – Paired image dataset to load data from.

  • device (str) – Device to train model on. Default is “cpu”.

  • metrics (list[str]) – Metrics to calculate out of “mse”, “pixel”, “psnr”, and “ssim”. Default is all.

  • avg (bool) – Whether to return a single averaged value per metric. Default is True.

  • norm (bool) – Whether to normalize prediction image intensities to ground truth. Default is True.

  • callbacks (list[Callable]) – Callbacks after each prediction. Can optionally specify an argument for locals to be passed. Default is None.

Returns:

Dictionary of metric names and outputs.

Return type:

metrics (dict[str, Any])