pyiqa.archs.mad_arch

MAD Metric

Created by: https://github.com/dingkeyan93/IQA-optimization/blob/master/IQA_pytorch/MAD.py

Modified by: Jiadi Mo (https://github.com/JiadiMo)

Note

Official matlab code is not available; Pytorch version >= 1.8.0;

Module Contents

pyiqa.archs.mad_arch.MAX[source]
pyiqa.archs.mad_arch.extract_patches_2d(img: torch.Tensor, patch_shape: list = [64, 64], step: list = [27, 27], batch_first: bool = True, keep_last_patch: bool = False) torch.Tensor[source]
pyiqa.archs.mad_arch.make_csf(rows, cols, nfreq)[source]
pyiqa.archs.mad_arch.get_moments(d, sk=False)[source]
pyiqa.archs.mad_arch.ical_stat(x, p=16, s=4)[source]
pyiqa.archs.mad_arch.ical_std(x, p=16, s=4)[source]
pyiqa.archs.mad_arch.hi_index(ref_img, dst_img)[source]
pyiqa.archs.mad_arch.gaborconvolve(im)[source]
pyiqa.archs.mad_arch.lo_index(ref, dst)[source]
class pyiqa.archs.mad_arch.MAD(channels=3, test_y_channel=False)[source]

Bases: torch.nn.Module

Parameters:
  • channel (-) – Number of input channel.

  • test_y_channel (-) – bool, whether to use y channel on ycbcr which mimics official matlab code.

References

Larson, Eric Cooper, and Damon Michael Chandler. “Most apparent distortion: full-reference image quality assessment and the role of strategy.” Journal of electronic imaging 19, no. 1 (2010): 011006.

mad(ref, dst)[source]

Compute MAD for a batch of images. :param ref: An reference tensor. Shape \((N, C, H, W)\). :param dst: A distortion tensor. Shape \((N, C, H, W)\).

forward(X, Y)[source]

Computation of CW-SSIM metric. :param X: An input tensor. Shape \((N, C, H, W)\). :param Y: A target tensor. Shape \((N, C, H, W)\).

Returns:

Value of MAD metric in [0, 1] range.