Skip to content

Normalization

Bases: ImageOnlyTransform

__init__

__init__(mean: ndarray, std: ndarray, p: float = 1.0, copy: bool = False, **kwargs) -> None

Image level normalization transformation.

NOTE: this is not dataset-level normalization but image-level.

Parameters:

Name Type Description Default
mean ndarray

Mean values for each channel. Shape (C,)

required
std ndarray

Standard deviation values for each channel. Shape (C,)

required
p float, default=1.0

Probability of applying the transformation.

1.0
copy bool, default=False

If True, normalize the copy of the input.

False

apply

apply(image: ndarray, **kwargs) -> np.ndarray

Apply image-level normalization to input image.

Parameters:

Name Type Description Default
image ndarray

Input image to be normalized. Shape (H, W, C)|(H, W).

required

Returns:

Type Description
ndarray

np.ndarray: Normalized image. Same shape as input. dtype: float32.

get_transform_init_args_names

get_transform_init_args_names()

Get the names of the transformation arguments.