Class GaussianBlur<T>
- Namespace
- AiDotNet.Augmentation.Image
- Assembly
- AiDotNet.dll
Applies Gaussian blur to an image.
public class GaussianBlur<T> : AugmentationBase<T, ImageTensor<T>>, IAugmentation<T, ImageTensor<T>>
Type Parameters
TThe numeric type for calculations.
- Inheritance
-
AugmentationBase<T, ImageTensor<T>>GaussianBlur<T>
- Implements
-
IAugmentation<T, ImageTensor<T>>
- Inherited Members
Remarks
Gaussian blur smooths the image by convolving it with a Gaussian kernel. This simulates out-of-focus images or motion blur, helping the model become robust to blurry inputs.
For Beginners: Think of this like looking at a photo through frosted glass. The image becomes softer and details are less sharp. This teaches your model to recognize objects even when they're not perfectly in focus.
When to use:
- When deployed images may be out of focus
- When training data is too sharp compared to real-world images
- To reduce high-frequency noise sensitivity
Constructors
GaussianBlur(double, double, int, double)
Creates a new Gaussian blur augmentation.
public GaussianBlur(double minSigma = 0.1, double maxSigma = 2, int kernelSize = 0, double probability = 0.5)
Parameters
minSigmadoubleThe minimum sigma for the Gaussian kernel. Industry standard default is 0.1.
maxSigmadoubleThe maximum sigma for the Gaussian kernel. Industry standard default is 2.0.
kernelSizeintThe kernel size for the blur. Use 0 for automatic size based on sigma. Industry standard default is 0 (automatic).
probabilitydoubleThe probability of applying this augmentation (0.0 to 1.0). Industry standard default is 0.5.
Properties
KernelSize
Gets the kernel size for the Gaussian blur.
public int KernelSize { get; }
Property Value
MaxSigma
Gets the maximum sigma (standard deviation) for the Gaussian kernel.
public double MaxSigma { get; }
Property Value
MinSigma
Gets the minimum sigma (standard deviation) for the Gaussian kernel.
public double MinSigma { get; }
Property Value
Methods
ApplyAugmentation(ImageTensor<T>, AugmentationContext<T>)
Applies Gaussian blur 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.