pyiqa.archs.entropy_arch

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

pyiqa.archs.entropy_arch.entropy(x, data_range=255.0, eps=1e-08, color_space='yiq')[source]

Compute grayscale entropy from an image tensor.

Parameters:
  • x (torch.Tensor) – Input tensor with shape (N, C, H, W).

  • data_range (float) – Maximum intensity value used for histogram bins.

  • eps (float) – Numerical stability constant in log2.

  • color_space (str) – Color space used when converting RGB to luminance.

Returns:

Entropy values with shape (N,).

Return type:

torch.Tensor

class pyiqa.archs.entropy_arch.Entropy(**kwargs)[source]

Bases: torch.nn.Module

Entropy-based no-reference image quality metric wrapper.

Parameters:

**kwargs – Keyword arguments forwarded to entropy().

forward(x)[source]

Compute entropy score for input batch.

Parameters:

x (torch.Tensor) – Image tensor with shape (N, C, H, W).

Returns:

Entropy score tensor with shape (N,).

Return type:

torch.Tensor