Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the user guide for the big picture.

nidl.volume.transforms.augmentation.RandomGaussianNoise

class nidl.volume.transforms.augmentation.RandomGaussianNoise(mean=0.0, std=(0.1, 1.0), **kwargs)[source]

Bases: VolumeTransform

Add Gaussian noise to input data with random parameters.

The input data can have any shape with type numpy.ndarray or torch.Tensor. The output has consistent type and shape with the input.

Parameters:
mean: float or (float, float), default=0.0

Mean \mu of the Gaussian distribution from which the noise is sampled. If two values (a, b) are given, then \mu \sim \mathcal{U}(a, b).

std: (float, float), default=(0.1, 1.0)

Range of the standard deviation (a, b) of the Gaussian distribution from which the noise is sampled \sigma \sim \mathcal{U}(a, b).

kwargs: dict

Keyword arguments.

__init__(mean=0.0, std=(0.1, 1.0), **kwargs)[source]
apply_transform(data)[source]

Add Gaussian noise to the input.

Parameters:
data: np.ndarray or torch.Tensor

The input volume.

Returns:
data: np.ndarray or torch.Tensor

Input with noise.