Table of Contents

Class VerticalFlip<T>

Namespace
AiDotNet.Augmentation.Image
Assembly
AiDotNet.dll

Flips an image vertically (top-bottom mirror).

public class VerticalFlip<T> : SpatialAugmentationBase<T, ImageTensor<T>>, ISpatialAugmentation<T, ImageTensor<T>>, IAugmentation<T, ImageTensor<T>>

Type Parameters

T

The numeric type for calculations.

Inheritance
VerticalFlip<T>
Implements
Inherited Members

Remarks

Vertical flipping mirrors the image along its horizontal center axis, swapping the top and bottom portions. This is less commonly used than horizontal flipping because most real-world objects have a consistent "up" orientation (gravity matters!).

For Beginners: Think of this like flipping a photo upside down. The top of the image becomes the bottom, and vice versa. Use this carefully because many objects look unnatural when flipped vertically (imagine an upside-down car or person).

When to use:

  • Satellite or aerial imagery where "up" is arbitrary
  • Microscopy images with no inherent orientation
  • Abstract pattern recognition
  • Medical imaging where orientation varies by acquisition

When NOT to use:

  • Natural photography with gravity-oriented subjects
  • Facial recognition or human pose estimation
  • Vehicle recognition (cars don't drive upside down)
  • Any task where vertical orientation is meaningful

Constructors

VerticalFlip(double)

Creates a new vertical flip augmentation.

public VerticalFlip(double probability = 0.5)

Parameters

probability double

The probability of applying this augmentation (0.0 to 1.0). Industry standard default is 0.5 (50% chance of flipping each image).

Remarks

For Beginners: A probability of 0.5 means each image has a 50-50 chance of being flipped. Consider using a lower probability (like 0.25) if vertical flips might create unrealistic-looking images for your use case.

Methods

ApplyWithTransformParams(ImageTensor<T>, AugmentationContext<T>)

Applies the vertical flip transformation and returns transform parameters.

protected override (ImageTensor<T> data, IDictionary<string, object> parameters) ApplyWithTransformParams(ImageTensor<T> data, AugmentationContext<T> context)

Parameters

data ImageTensor<T>
context AugmentationContext<T>

Returns

(ImageTensor<T> data, IDictionary<string, object> parameters)

GetParameters()

Gets the parameters of this augmentation.

public override IDictionary<string, object> GetParameters()

Returns

IDictionary<string, object>

A dictionary of parameter names to values.

TransformBoundingBox(BoundingBox<T>, IDictionary<string, object>, AugmentationContext<T>)

Transforms a bounding box after vertical flip.

protected override BoundingBox<T> TransformBoundingBox(BoundingBox<T> box, IDictionary<string, object> transformParams, AugmentationContext<T> context)

Parameters

box BoundingBox<T>
transformParams IDictionary<string, object>
context AugmentationContext<T>

Returns

BoundingBox<T>

TransformKeypoint(Keypoint<T>, IDictionary<string, object>, AugmentationContext<T>)

Transforms a keypoint after vertical flip.

protected override Keypoint<T> TransformKeypoint(Keypoint<T> keypoint, IDictionary<string, object> transformParams, AugmentationContext<T> context)

Parameters

keypoint Keypoint<T>
transformParams IDictionary<string, object>
context AugmentationContext<T>

Returns

Keypoint<T>

TransformMask(SegmentationMask<T>, IDictionary<string, object>, AugmentationContext<T>)

Transforms a segmentation mask after vertical flip.

protected override SegmentationMask<T> TransformMask(SegmentationMask<T> mask, IDictionary<string, object> transformParams, AugmentationContext<T> context)

Parameters

mask SegmentationMask<T>
transformParams IDictionary<string, object>
context AugmentationContext<T>

Returns

SegmentationMask<T>