pyiqa.archs.mad_arch ==================== .. py:module:: pyiqa.archs.mad_arch .. autoapi-nested-parse:: 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 --------------- .. py:data:: MAX .. py:function:: 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 .. py:function:: make_csf(rows, cols, nfreq) .. py:function:: get_moments(d, sk=False) .. py:function:: ical_stat(x, p=16, s=4) .. py:function:: ical_std(x, p=16, s=4) .. py:function:: hi_index(ref_img, dst_img) .. py:function:: gaborconvolve(im) .. py:function:: lo_index(ref, dst) .. py:class:: MAD(channels=3, test_y_channel=False) Bases: :py:obj:`torch.nn.Module` :param - channel: Number of input channel. :param - test_y_channel: bool, whether to use y channel on ycbcr which mimics official matlab code. .. rubric:: 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. .. py:method:: mad(ref, dst) Compute MAD for a batch of images. :param ref: An reference tensor. Shape :math:`(N, C, H, W)`. :param dst: A distortion tensor. Shape :math:`(N, C, H, W)`. .. py:method:: forward(X, Y) Computation of CW-SSIM metric. :param X: An input tensor. Shape :math:`(N, C, H, W)`. :param Y: A target tensor. Shape :math:`(N, C, H, W)`. :returns: Value of MAD metric in [0, 1] range.