Table of Contents

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

T

The numeric type for calculations.

Inheritance
ImageAugmenterBase<T>
Implements
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

probability double

The 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

image ImageTensor<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

image ImageTensor<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

image ImageTensor<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

image ImageTensor<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

image ImageTensor<T>

The input image.

Returns

bool

True if the image is grayscale.