pyiqa.archs.entropy_arch ======================== .. py:module:: pyiqa.archs.entropy_arch .. autoapi-nested-parse:: Entropy Metric for grayscale images. Entropy is a statistical measure of randomness that can be used to characterize the texture of the input image. Created by: Chaofeng Chen (https://github.com/chaofengc) Refer to: Matlab: https://www.mathworks.com/help/images/ref/entropy.html Module Contents --------------- .. py:function:: entropy(x, data_range=255.0, eps=1e-08, color_space='yiq') Compute grayscale entropy from an image tensor. :param x: Input tensor with shape ``(N, C, H, W)``. :type x: torch.Tensor :param data_range: Maximum intensity value used for histogram bins. :type data_range: float :param eps: Numerical stability constant in ``log2``. :type eps: float :param color_space: Color space used when converting RGB to luminance. :type color_space: str :returns: Entropy values with shape ``(N,)``. :rtype: torch.Tensor .. py:class:: Entropy(**kwargs) Bases: :py:obj:`torch.nn.Module` Entropy-based no-reference image quality metric wrapper. :param \*\*kwargs: Keyword arguments forwarded to :func:`entropy`. .. py:method:: forward(x) Compute entropy score for input batch. :param x: Image tensor with shape ``(N, C, H, W)``. :type x: torch.Tensor :returns: Entropy score tensor with shape ``(N,)``. :rtype: torch.Tensor