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
TThe numeric type for calculations.
- Inheritance
-
AugmentationBase<T, ImageTensor<T>>GaussianNoise<T>
- Implements
-
IAugmentation<T, ImageTensor<T>>
- 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
meandoubleThe mean of the Gaussian distribution. Industry standard default is 0.0 (no bias).
minStddoubleThe minimum standard deviation of the noise. Industry standard default is 0.01.
maxStddoubleThe maximum standard deviation of the noise. Industry standard default is 0.05.
probabilitydoubleThe probability of applying this augmentation (0.0 to 1.0). Industry standard default is 0.5.
minValuedoubleThe minimum valid pixel value for clamping. Default is 0.0 for normalized images.
maxValuedoubleThe 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
MaxValue
Gets the maximum valid pixel value (for clamping).
public double MaxValue { get; }
Property Value
Mean
Gets the mean of the Gaussian distribution.
public double Mean { get; }
Property Value
MinStd
Gets the minimum standard deviation of the noise.
public double MinStd { get; }
Property Value
MinValue
Gets the minimum valid pixel value (for clamping).
public double MinValue { get; }
Property Value
Methods
ApplyAugmentation(ImageTensor<T>, AugmentationContext<T>)
Applies Gaussian noise to the image.
protected override ImageTensor<T> ApplyAugmentation(ImageTensor<T> data, AugmentationContext<T> context)
Parameters
dataImageTensor<T>contextAugmentationContext<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.