Class ImageAugmenterBase<T>
- Namespace
- AiDotNet.Augmentation.Image
- Assembly
- AiDotNet.dll
Base class for image data augmentations.
public abstract class ImageAugmenterBase<T> : AugmentationBase<T, ImageTensor<T>>, IAugmentation<T, ImageTensor<T>>
Type Parameters
TThe numeric type for calculations.
- Inheritance
-
AugmentationBase<T, ImageTensor<T>>ImageAugmenterBase<T>
- Implements
-
IAugmentation<T, ImageTensor<T>>
- Inherited Members
Remarks
For Beginners: Image augmentation transforms images to improve model robustness to variations in viewpoint, lighting, and appearance. Common techniques include:
- Geometric transforms: flips, rotations, scaling, cropping
- Color transforms: brightness, contrast, saturation, hue
- Noise and blur: Gaussian noise, blur, sharpening
- Regularization: cutout, mixup, cutmix
Image data is represented as an ImageTensor with dimensions (height, width, channels).
Constructors
ImageAugmenterBase(double)
Initializes a new image augmentation.
protected ImageAugmenterBase(double probability = 1)
Parameters
probabilitydoubleThe probability of applying this augmentation (0.0 to 1.0).
Methods
GetChannels(ImageTensor<T>)
Gets the number of channels in the image.
protected int GetChannels(ImageTensor<T> image)
Parameters
imageImageTensor<T>The input image.
Returns
- int
The number of channels (typically 1, 3, or 4).
GetHeight(ImageTensor<T>)
Gets the height of the image.
protected int GetHeight(ImageTensor<T> image)
Parameters
imageImageTensor<T>The input image.
Returns
- int
The height in pixels.
GetWidth(ImageTensor<T>)
Gets the width of the image.
protected int GetWidth(ImageTensor<T> image)
Parameters
imageImageTensor<T>The input image.
Returns
- int
The width in pixels.
HasAlpha(ImageTensor<T>)
Checks if the image has an alpha channel.
protected bool HasAlpha(ImageTensor<T> image)
Parameters
imageImageTensor<T>The input image.
Returns
- bool
True if the image has 4 channels (RGBA).
IsGrayscale(ImageTensor<T>)
Checks if the image is grayscale (single channel).
protected bool IsGrayscale(ImageTensor<T> image)
Parameters
imageImageTensor<T>The input image.
Returns
- bool
True if the image is grayscale.