IQM_Vis.metrics package
Subpackages
Submodules
IQM_Vis.metrics.metric_utils module
Helper functions for metric computation
IQM_Vis.metrics.non_perceptual module
- class IQM_Vis.metrics.non_perceptual.MAE(return_image=False)[source]
Bases:
object
- Mean Absolute Error between two images. Images must have the same
dimensions
- Parameters
return_image (bool) – Whether to return the image (Defaults to False which will return a scalar value)
- __call__(im_ref, im_comp, **kwargs)[source]
When an instance is called
- Parameters
im_ref (np.array) – Reference image
im_comp (np.array) – Comparison image
**kwargs – Arbitrary keyword arguments
- Returns
- MAE (scalar if return_image is False, image if
return_image is True)
- Return type
score (np.array)
- class IQM_Vis.metrics.non_perceptual.MSE(return_image=False)[source]
Bases:
object
- Mean Squared Error between two images. Images must have the same
dimensions
- Parameters
return_image (bool) – Whether to return the image (Defaults to False which will return a scalar value)
- __call__(im_ref, im_comp, **kwargs)[source]
When an instance is called
- Parameters
im_ref (np.array) – Reference image
im_comp (np.array) – Comparison image
**kwargs – Arbitrary keyword arguments
- Returns
- MSE (scalar if return_image is False, image if
return_image is True)
- Return type
score (np.array)
- class IQM_Vis.metrics.non_perceptual.RMSE(return_image=False)[source]
Bases:
object
- Root Mean Squared Error between two images. Images must have the same
dimensions
- Parameters
return_image (bool) – Whether to return the image (Defaults to False which will return a scalar value)
- __call__(im_ref, im_comp, **kwargs)[source]
When an instance is called
- Parameters
im_ref (np.array) – Reference image
im_comp (np.array) – Comparison image
**kwargs – Arbitrary keyword arguments
- Returns
- RMSE (scalar if return_image is False, image if
return_image is True)
- Return type
score (np.array)
- class IQM_Vis.metrics.non_perceptual.one_over_PSNR[source]
Bases:
object
Peak signal to noise ratio - https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio The score given is normalised between 0, 1 by taking 1/PSNR
- Parameters
return_image (bool) – Whether to return the image (Defaults to False which will return a scalar value)
IQM_Vis.metrics.perceptual_DL module
- class IQM_Vis.metrics.perceptual_DL.DISTS[source]
Bases:
object
Deep Image Structure and Texture Similarity (DISTS) Metric. Uses the code from https://github.com/dingkeyan93/DISTS. Uses the PyTorch backend. It is robust to texture variance (e.g., evaluating the images generated by GANs) and mild geometric transformations (e.g., evaluating the image pairs that are not strictly point-by-point aligned).
- class IQM_Vis.metrics.perceptual_DL.LPIPS(network='alex', reduction='mean')[source]
Bases:
object
- Learned Perceptual Image Patch Similarity between two images.
Images must have the same dimensions.
- Parameters
network (str) – Pretrained network to use. Choose between ‘alex’, ‘vgg’ or ‘squeeze’. (Defaults to ‘alex’)
reduction (str) – How to reduce over the batch dimension. Choose between ‘sum’ or ‘mean’. (Defaults to ‘mean’)
IQM_Vis.metrics.perceptual_trad module
- class IQM_Vis.metrics.perceptual_trad.MS_SSIM(return_image=False)[source]
Bases:
object
- Multi-Scale Structural Similarity Index Measure between two images.
Images must have the same dimensions. Score given is 1 - MS_SSIM to give the loss/dissimilarity. Note that images of small size, below 180 pixels will have their kernel size reduced for compatability with the 4 downsizing operations.
- Parameters
return_image (bool) – Whether to return the image (Defaults to False which will return a scalar value)
- __call__(im_ref, im_comp, sigma=1.5, k1=0.01, k2=0.03, mssim_kernel_size=11, **kwargs)[source]
When an instance is called
- Parameters
im_ref (np.array) – Reference image
im_comp (np.array) – Comparison image
**kwargs – Arbitrary keyword arguments
- Returns
- 1-SSIM (scalar if return_image is False, image if
return_image is True)
- Return type
score (np.array)
- class IQM_Vis.metrics.perceptual_trad.NLPD[source]
Bases:
object
Normalised Laplacian pyramid Proposed by Valero Laparra et al. https://www.uv.es/lapeva/papers/2016_HVEI.pdf . NLPD is an image quality metric based on the transformations associated with the early visual system: local luminance subtraction and local gain control.
- class IQM_Vis.metrics.perceptual_trad.SSIM(return_image=False)[source]
Bases:
object
- Structural Similarity Index Measure between two images. Images must have
the same dimensions. Score given is 1 - SSIM to give the loss/dissimilarity
- Parameters
return_image (bool) – Whether to return the image (Defaults to False which will return a scalar value)
- __call__(im_ref, im_comp, sigma=1.5, k1=0.01, k2=0.03, ssim_kernel_size=11, **kwargs)[source]
When an instance is called
- Parameters
im_ref (np.array) – Reference image
im_comp (np.array) – Comparison image
**kwargs – Arbitrary keyword arguments
- Returns
- 1-SSIM (scalar if return_image is False, image if
return_image is True)
- Return type
score (np.array)
Module contents
- IQM_Vis.metrics.get_all_IQM_params()[source]
Get all available IQMs parameters
- Returns
all_params (dict)