piqa.utils.color#
Color space conversion tools
Functions#
Returns the color convolution of \(x\) with the kernel |
|
Converts from sRGB to (CIE) XYZ. |
|
Converts from (CIE) XYZ to (CIE) LAB. |
Classes#
Color convolution module. |
|
Normalizes channels with respect to ImageNet's mean and standard deviation. |
Descriptions#
- piqa.utils.color.color_conv(x, weight, bias=None)#
Returns the color convolution of \(x\) with the kernel
weight
.
- class piqa.utils.color.ColorConv(src, dst)#
Color convolution module.
- Parameters:
Example
>>> x = torch.rand(5, 3, 256, 256) >>> conv = ColorConv('RGB', 'YIQ') >>> y = conv(x) >>> y.shape torch.Size([5, 3, 256, 256])
- piqa.utils.color.rgb_to_xyz(x, value_range=1.0)#
Converts from sRGB to (CIE) XYZ.
Wikipedia
https://wikipedia.org/wiki/SRGB
- Parameters:
value_range (float) – The value range \(L\) of the inputs (usually 1 or 255).
- piqa.utils.color.xyz_to_lab(x)#
Converts from (CIE) XYZ to (CIE) LAB.
Wikipedia
https://wikipedia.org/wiki/CIELAB_color_space
- class piqa.utils.color.ImageNetNorm#
Normalizes channels with respect to ImageNet’s mean and standard deviation.
References
ImageNet: A large-scale hierarchical image database (Deng et al, 2009)Example
>>> x = torch.rand(5, 3, 256, 256) >>> normalize = ImageNetNorm() >>> x = normalize(x) >>> x.shape torch.Size([5, 3, 256, 256])