Table of Contents

Class GaussianNoise<T>

Namespace
AiDotNet.Augmentation.Image
Assembly
AiDotNet.dll

Adds Gaussian noise to an image.

public class GaussianNoise<T> : AugmentationBase<T, ImageTensor<T>>, IAugmentation<T, ImageTensor<T>>

Type Parameters

T

The numeric type for calculations.

Inheritance
GaussianNoise<T>
Implements
Inherited Members

Remarks

Gaussian noise adds random values drawn from a normal (Gaussian) distribution to each pixel. This simulates sensor noise in cameras and helps the model become robust to noisy inputs.

For Beginners: Think of this like the "grain" you see in photos taken in low light. Adding random noise to training images teaches your model to focus on the real features rather than memorizing exact pixel values.

When to use:

  • When training data is too clean (synthetic or studio images)
  • When deployed images may have sensor noise
  • As a regularization technique to prevent overfitting

Constructors

GaussianNoise(double, double, double, double, double, double)

Creates a new Gaussian noise augmentation.

public GaussianNoise(double mean = 0, double minStd = 0.01, double maxStd = 0.05, double probability = 0.5, double minValue = 0, double maxValue = 1)

Parameters

mean double

The mean of the Gaussian distribution. Industry standard default is 0.0 (no bias).

minStd double

The minimum standard deviation of the noise. Industry standard default is 0.01.

maxStd double

The maximum standard deviation of the noise. Industry standard default is 0.05.

probability double

The probability of applying this augmentation (0.0 to 1.0). Industry standard default is 0.5.

minValue double

The minimum valid pixel value for clamping. Default is 0.0 for normalized images.

maxValue double

The maximum valid pixel value for clamping. Default is 1.0 for normalized images.

Properties

MaxStd

Gets the maximum standard deviation of the noise.

public double MaxStd { get; }

Property Value

double

MaxValue

Gets the maximum valid pixel value (for clamping).

public double MaxValue { get; }

Property Value

double

Mean

Gets the mean of the Gaussian distribution.

public double Mean { get; }

Property Value

double

MinStd

Gets the minimum standard deviation of the noise.

public double MinStd { get; }

Property Value

double

MinValue

Gets the minimum valid pixel value (for clamping).

public double MinValue { get; }

Property Value

double

Methods

ApplyAugmentation(ImageTensor<T>, AugmentationContext<T>)

Applies Gaussian noise to the image.

protected override ImageTensor<T> ApplyAugmentation(ImageTensor<T> data, AugmentationContext<T> context)

Parameters

data ImageTensor<T>
context AugmentationContext<T>

Returns

ImageTensor<T>

GetParameters()

Gets the parameters of this augmentation.

public override IDictionary<string, object> GetParameters()

Returns

IDictionary<string, object>

A dictionary of parameter names to values.