Table of Contents

Class AugmentationPipeline<T, TData>

Namespace
AiDotNet.Augmentation
Assembly
AiDotNet.dll

Represents a pipeline of augmentations that are applied in sequence or composition.

public class AugmentationPipeline<T, TData> : IAugmentationPolicy<T, TData>, IAugmentationPolicy

Type Parameters

T

The numeric type for calculations.

TData

The data type being augmented.

Inheritance
AugmentationPipeline<T, TData>
Implements
Inherited Members

Remarks

AugmentationPipeline allows you to compose multiple augmentations together. Each augmentation in the pipeline is applied with its own probability, and the order can be sequential, random, or one-of.

For Beginners: Think of this as a recipe of transformations. You might want to first flip an image, then rotate it, then adjust the colors. This pipeline handles all of that automatically.

Constructors

AugmentationPipeline(string?)

Creates a new augmentation pipeline with an optional name.

public AugmentationPipeline(string? name = null)

Parameters

name string

The name of this pipeline.

Properties

AugmentationCount

Gets the number of augmentations in this policy.

public int AugmentationCount { get; }

Property Value

int

AugmentationNames

Gets the augmentation names in this policy.

public IList<string> AugmentationNames { get; }

Property Value

IList<string>

Augmentations

Gets the augmentations in this policy.

public IList<IAugmentation<T, TData>> Augmentations { get; }

Property Value

IList<IAugmentation<T, TData>>

Name

Gets the name of this policy.

public string Name { get; set; }

Property Value

string

Order

Gets or sets the application order for augmentations.

public AugmentationOrder Order { get; set; }

Property Value

AugmentationOrder

Methods

Add(IAugmentation<T, TData>)

Adds an augmentation to the pipeline.

public AugmentationPipeline<T, TData> Add(IAugmentation<T, TData> augmentation)

Parameters

augmentation IAugmentation<T, TData>

The augmentation to add.

Returns

AugmentationPipeline<T, TData>

This pipeline for method chaining.

Exceptions

ArgumentNullException

Thrown if augmentation is null.

AddRange(IEnumerable<IAugmentation<T, TData>>)

Adds multiple augmentations to the pipeline.

public AugmentationPipeline<T, TData> AddRange(IEnumerable<IAugmentation<T, TData>> augmentations)

Parameters

augmentations IEnumerable<IAugmentation<T, TData>>

The augmentations to add.

Returns

AugmentationPipeline<T, TData>

This pipeline for method chaining.

Exceptions

ArgumentNullException

Thrown if augmentations is null.

Apply(TData, AugmentationContext<T>?)

Applies the policy to input data.

public TData Apply(TData data, AugmentationContext<T>? context = null)

Parameters

data TData

The input data.

context AugmentationContext<T>

The augmentation context.

Returns

TData

The augmented data.

GetConfiguration()

Gets the parameters of this policy for serialization.

public IDictionary<string, object> GetConfiguration()

Returns

IDictionary<string, object>

A dictionary of policy configuration.

OneOf(params IAugmentation<T, TData>[])

Creates a sub-pipeline that applies one-of the specified augmentations.

public AugmentationPipeline<T, TData> OneOf(params IAugmentation<T, TData>[] augmentations)

Parameters

augmentations IAugmentation<T, TData>[]

The augmentations to choose from.

Returns

AugmentationPipeline<T, TData>

This pipeline for method chaining.

Shuffle(params IAugmentation<T, TData>[])

Creates a sub-pipeline with random ordering.

public AugmentationPipeline<T, TData> Shuffle(params IAugmentation<T, TData>[] augmentations)

Parameters

augmentations IAugmentation<T, TData>[]

The augmentations to shuffle.

Returns

AugmentationPipeline<T, TData>

This pipeline for method chaining.