Image Quality Metrics
LPIPSMetric
Bases: Scorer
LPIPS Metric to compute the Learned Perceptual Image Patch Similarity (LPIPS) score between two images. LPIPS essentially computes the similarity between the activations of two image patches for some pre-defined network. This measure has been shown to match human perception well. A low LPIPS score means that image patches are perceptual similar.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lpips_net_type
|
str
|
The network type to use for computing LPIPS. One of "alex", "vgg", or "squeeze". |
'alex'
|
image_height
|
int
|
The height to which images will be resized before computing LPIPS. |
512
|
image_width
|
int
|
The width to which images will be resized before computing LPIPS. |
512
|
Source code in hemm/metrics/image_quality/lpips.py
PSNRMetric
Bases: Scorer
PSNR Metric to compute the Peak Signal-to-Noise Ratio (PSNR) between two images.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
psnr_base
|
float
|
The base of the logarithm in the PSNR formula. |
10.0
|
psnr_data_range
|
Optional[Union[float, Tuple[float, float]]]
|
The data range of the input image (min, max). If None, the data range is determined from the image data type. |
None
|
image_height
|
int
|
The height to which images will be resized before computing PSNR. |
512
|
image_width
|
int
|
The width to which images will be resized before computing PSNR. |
512
|
Source code in hemm/metrics/image_quality/psnr.py
SSIMMetric
Bases: Scorer
SSIM Metric to compute the Structural Similarity Index Measure (SSIM) between two images.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ssim_gaussian_kernel
|
bool
|
Whether to use a Gaussian kernel for SSIM computation. |
True
|
ssim_sigma
|
float
|
The standard deviation of the Gaussian kernel. |
1.5
|
ssim_kernel_size
|
int
|
The size of the Gaussian kernel. |
11
|
ssim_data_range
|
Optional[Union[float, Tuple[float, float]]]
|
The data range of the input image (min, max). If None, the data range is determined from the image data type. |
None
|
ssim_k1
|
float
|
The constant used to stabilize the SSIM numerator. |
0.01
|
ssim_k2
|
float
|
The constant used to stabilize the SSIM denominator. |
0.03
|
image_height
|
int
|
The height to which images will be resized before computing SSIM. |
512
|
image_width
|
int
|
The width to which images will be resized before computing SSIM. |
512
|
Source code in hemm/metrics/image_quality/ssim.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|