Applies various normalization techniques to an image. The specific normalization technique can be selected
with the normalization parameter.
Standard normalization is applied using the formula:
img = (img - mean * max_pixel_value) / (std * max_pixel_value).
Other normalization techniques adjust the image based on global or per-channel statistics,
or scale pixel values to a specified range.
meanMean values for standard normalization. For "standard" normalization, the default values are ImageNet mean values: (0.485, 0.456, 0.406).
stdStandard deviation values for standard normalization. For "standard" normalization, the default values are ImageNet standard deviation :(0.229, 0.224, 0.225).
max_pixel_valueMaximum possible pixel value, used for scaling in standard normalization. Defaults to 255.0.
normalizationSpecifies the normalization technique to apply. Defaults to "standard".
(img - mean * max_pixel_value) / (std * max_pixel_value).
The default mean and std are based on ImageNet. You can use mean and std values of (0.5, 0.5, 0.5)
for inception normalization. And mean values of (0, 0, 0) and std values of (1, 1, 1) for YOLO.pProbability of applying the transform. Defaults to 1.0.
>>> import numpy as np
>>> import albumentations as A
>>> image = np.random.randint(0, 256, (100, 100, 3), dtype=np.uint8)
>>> # Standard ImageNet normalization
>>> transform = A.Normalize(
... mean=(0.485, 0.456, 0.406),
... std=(0.229, 0.224, 0.225),
... max_pixel_value=255.0,
... p=1.0
... )
>>> normalized_image = transform(image=image)["image"]
>>>
>>> # Min-max normalization
>>> transform_minmax = A.Normalize(normalization="min_max", p=1.0)
>>> normalized_image_minmax = transform_minmax(image=image)["image"]mean, std, and max_pixel_value must be provided.