class
Normalize
extends
_NoParamsPhotometricTransform[Empty]Normalize(mean: tuple[float, ...], std: tuple[float, ...], max_pixel_value: float = 255.0, p: float = 1.0)Normalize an image (Albumentations Normalize).
Computes (img - mean * max_pixel_value) / (std * max_pixel_value)
— i.e. scales by max_pixel_value then standardizes per channel.
Parameters
meantuple of floatPer-channel statistics.
stdtuple of floatPer-channel statistics.
max_pixel_valuefloat= 255.0Value the inputs are divided by (
1.0 for [0, 1] inputs).pfloat= 1.0No description.
Examples
>>> import lucid, lucid.utils.transforms as T
>>> tf = T.Normalize(mean=(0.485, 0.456, 0.406),
... std=(0.229, 0.224, 0.225), max_pixel_value=1.0)
>>> tuple(tf(T.Image(lucid.rand(3, 32, 32))).data.shape)
(3, 32, 32)
max_pixel_value divides before the mean is taken, so it is 255
for an image read from a file and 1.0 for one already in 0-1.