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
TThe numeric type for calculations.
- Inheritance
-
AugmentationBase<T, ImageTensor<T>[]>SpatialTransform<T>
- Implements
-
IAugmentation<T, ImageTensor<T>[]>
- 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
horizontalFlipProbabilitydoubleProbability of horizontal flip (default: 0.5).
verticalFlipProbabilitydoubleProbability of vertical flip (default: 0.5).
probabilitydoubleProbability of applying any transform (default: 0.5).
frameRatedoubleFrame rate of the video (default: 30).
Properties
EnableHorizontalFlip
Gets or sets whether to enable horizontal flip.
public bool EnableHorizontalFlip { get; set; }
Property Value
EnableRotation90
Gets or sets whether to enable 90° rotations.
public bool EnableRotation90 { get; set; }
Property Value
EnableVerticalFlip
Gets or sets whether to enable vertical flip.
public bool EnableVerticalFlip { get; set; }
Property Value
HorizontalFlipProbability
Gets the probability of horizontal flip (when enabled).
public double HorizontalFlipProbability { get; }
Property Value
VerticalFlipProbability
Gets the probability of vertical flip (when enabled).
public double VerticalFlipProbability { get; }
Property Value
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
dataImageTensor<T>[]The input data.
contextAugmentationContext<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.