Table of Contents

Class SpatialTransform<T>

Namespace
AiDotNet.Augmentation.Video
Assembly
AiDotNet.dll

Applies spatial transformations (flips, rotations) consistently to all frames.

public class SpatialTransform<T> : SpatialVideoAugmenterBase<T>, IAugmentation<T, ImageTensor<T>[]>

Type Parameters

T

The numeric type for calculations.

Inheritance
SpatialTransform<T>
Implements
Inherited Members

Remarks

For Beginners: Spatial transform applies image augmentations like horizontal flip or rotation to all frames in the video consistently. This ensures the transformation is coherent across the entire video.

Available transforms:

  • Horizontal flip (mirror left-right)
  • Vertical flip (mirror top-bottom)
  • 90° rotation (clockwise)
  • 180° rotation
  • 270° rotation (counter-clockwise)

Constructors

SpatialTransform(double, double, double, double)

Creates a new spatial transform augmentation.

public SpatialTransform(double horizontalFlipProbability = 0.5, double verticalFlipProbability = 0.5, double probability = 0.5, double frameRate = 30)

Parameters

horizontalFlipProbability double

Probability of horizontal flip (default: 0.5).

verticalFlipProbability double

Probability of vertical flip (default: 0.5).

probability double

Probability of applying any transform (default: 0.5).

frameRate double

Frame rate of the video (default: 30).

Properties

EnableHorizontalFlip

Gets or sets whether to enable horizontal flip.

public bool EnableHorizontalFlip { get; set; }

Property Value

bool

EnableRotation90

Gets or sets whether to enable 90° rotations.

public bool EnableRotation90 { get; set; }

Property Value

bool

EnableVerticalFlip

Gets or sets whether to enable vertical flip.

public bool EnableVerticalFlip { get; set; }

Property Value

bool

HorizontalFlipProbability

Gets the probability of horizontal flip (when enabled).

public double HorizontalFlipProbability { get; }

Property Value

double

VerticalFlipProbability

Gets the probability of vertical flip (when enabled).

public double VerticalFlipProbability { get; }

Property Value

double

Methods

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

Implement this method to perform the actual augmentation.

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

Parameters

data ImageTensor<T>[]

The input data.

context AugmentationContext<T>

The augmentation context.

Returns

ImageTensor<T>[]

The augmented data.

GetParameters()

Gets the parameters of this augmentation.

public override IDictionary<string, object> GetParameters()

Returns

IDictionary<string, object>

A dictionary of parameter names to values.