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
TThe numeric type for calculations.
TDataThe data type being augmented.
- Inheritance
-
AugmentationPipeline<T, TData>
- Implements
-
IAugmentationPolicy<T, TData>
- 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
namestringThe name of this pipeline.
Properties
AugmentationCount
Gets the number of augmentations in this policy.
public int AugmentationCount { get; }
Property Value
AugmentationNames
Gets the augmentation names in this policy.
public IList<string> AugmentationNames { get; }
Property Value
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
Order
Gets or sets the application order for augmentations.
public AugmentationOrder Order { get; set; }
Property Value
Methods
Add(IAugmentation<T, TData>)
Adds an augmentation to the pipeline.
public AugmentationPipeline<T, TData> Add(IAugmentation<T, TData> augmentation)
Parameters
augmentationIAugmentation<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
augmentationsIEnumerable<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
dataTDataThe input data.
contextAugmentationContext<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
augmentationsIAugmentation<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
augmentationsIAugmentation<T, TData>[]The augmentations to shuffle.
Returns
- AugmentationPipeline<T, TData>
This pipeline for method chaining.