pyiqa.archs.fsim_arch ===================== .. py:module:: pyiqa.archs.fsim_arch .. autoapi-nested-parse:: FSIM Metric @article{zhang2011fsim, title={FSIM: A feature similarity index for image quality assessment}, author={Zhang, Lin and Zhang, Lei and Mou, Xuanqin and Zhang, David}, journal={IEEE transactions on Image Processing}, volume={20}, number={8}, pages={2378--2386}, year={2011}, publisher={IEEE} } Created by: https://github.com/photosynthesis-team/piq/blob/master/piq/fsim.py Modified by: Jiadi Mo (https://github.com/JiadiMo) Refer to: Official matlab code from https://www4.comp.polyu.edu.hk/~cslzhang/IQA/FSIM/Files/FeatureSIM.m PIQA from https://github.com/francois-rozet/piqa/blob/master/piqa/fsim.py Module Contents --------------- .. py:function:: fsim(x: torch.Tensor, y: torch.Tensor, chromatic: bool = True, scales: int = 4, orientations: int = 4, min_length: int = 6, mult: int = 2, sigma_f: float = 0.55, delta_theta: float = 1.2, k: float = 2.0) -> torch.Tensor Compute Feature Similarity Index Measure for a batch of images. :param - x: An input tensor. Shape :math:`(N, C, H, W)`. :param - y: A target tensor. Shape :math:`(N, C, H, W)`. :param - chromatic: Flag to compute FSIMc, which also takes into account chromatic components :param - scales: Number of wavelets used for computation of phase congruensy maps :param - orientations: Number of filter orientations used for computation of phase congruensy maps :param - min_length: Wavelength of smallest scale filter :param - mult: Scaling factor between successive filters :param - sigma_f: Ratio of the standard deviation of the Gaussian describing the log Gabor filter's :param transfer function in the frequency domain to the filter center frequency.: :param - delta_theta: Ratio of angular interval between filter orientations and the standard deviation :param of the angular Gaussian function used to construct filters in the frequency plane.: :param - k: No of standard deviations of the noise energy beyond the mean at which we set the noise threshold point, below which phase congruency values get penalized. :returns: - Index of similarity between two images. Usually in [0, 1] interval. Can be bigger than 1 for predicted :math:`x` images with higher contrast than the original ones. .. rubric:: References L. Zhang, L. Zhang, X. Mou and D. Zhang, "FSIM: A Feature Similarity Index for Image Quality Assessment," IEEE Transactions on Image Processing, vol. 20, no. 8, pp. 2378-2386, Aug. 2011, doi: 10.1109/TIP.2011.2109730. https://ieeexplore.ieee.org/document/5705575 .. py:class:: FSIM(chromatic: bool = True, scales: int = 4, orientations: int = 4, min_length: int = 6, mult: int = 2, sigma_f: float = 0.55, delta_theta: float = 1.2, k: float = 2.0) Bases: :py:obj:`torch.nn.Module` :param - chromatic: Flag to compute FSIMc, which also takes into account chromatic components :param - scales: Number of wavelets used for computation of phase congruensy maps :param - orientations: Number of filter orientations used for computation of phase congruensy maps :param - min_length: Wavelength of smallest scale filter :param - mult: Scaling factor between successive filters :param - sigma_f: Ratio of the standard deviation of the Gaussian describing the log Gabor filter's :param transfer function in the frequency domain to the filter center frequency.: :param - delta_theta: Ratio of angular interval between filter orientations and the standard deviation :param of the angular Gaussian function used to construct filters in the frequency plane.: :param - k: No of standard deviations of the noise energy beyond the mean at which we set the noise threshold point, below which phase congruency values get penalized. .. rubric:: References L. Zhang, L. Zhang, X. Mou and D. Zhang, "FSIM: A Feature Similarity Index for Image Quality Assessment," IEEE Transactions on Image Processing, vol. 20, no. 8, pp. 2378-2386, Aug. 2011, doi: 10.1109/TIP.2011.2109730. https://ieeexplore.ieee.org/document/5705575 .. py:method:: forward(X: torch.Tensor, Y: torch.Tensor) -> torch.Tensor Computation of FSIM as a loss function. :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 FSIM loss to be minimized in [0, 1] range.