SomeOf<T, TData>

Models & Types · AiDotNet.Augmentation

Randomly selects and applies N augmentations from a set.

Implements: ISpatialAugmentation<T, TData>

For Beginners

Think of this like drawing cards from a deck. You pick 2 or 3 random transformations and apply them one after another. This creates more variety in your training data.

How It Works

SomeOf randomly chooses N augmentations from the provided set and applies them in sequence. The number N can be fixed or randomly sampled from a range. This provides more variety than OneOf while still limiting the total augmentation.

Example usage:

Constructors

Constructor Summary
SomeOf(int minN, int maxN, IEnumerable<IAugmentation<T, TData>> augmentations, double probability, bool randomizeOrder) Creates a new SomeOf with a range of augmentations to apply.
SomeOf(int n, IAugmentation<T, TData>[] augmentations) Creates a new SomeOf with a fixed number of augmentations.
SomeOf(int n, IEnumerable<IAugmentation<T, TData>> augmentations, double probability, bool randomizeOrder) Creates a new SomeOf with a fixed number of augmentations.

Properties

Property Summary
IReadOnlyList<IAugmentation<T, TData>> Augmentations { get; } Gets the list of augmentations to choose from.
bool IsEnabled { get; set; }
bool IsTrainingOnly { get; set; }
bool RandomizeOrder { get; } Gets whether the selected augmentations should be applied in random order.
bool SupportsBoundingBoxes { get; }
bool SupportsKeypoints { get; }
bool SupportsMasks { get; }
double Probability { get; }
int MaxN { get; } Gets the maximum number of augmentations to apply.
int MinN { get; } Gets the minimum number of augmentations to apply.
string Name { get; }

Methods

Method Summary
AugmentedSample<T, TData> ApplyWithTargets(AugmentedSample<T, TData> sample, AugmentationContext<T> context)
IDictionary<string, object> GetParameters()
TData Apply(TData data, AugmentationContext<T> context)