Interface IAugmentation<T, TData>
- Namespace
- AiDotNet.Augmentation
- Assembly
- AiDotNet.dll
Base interface for all data augmentations across domains (image, audio, tabular).
public interface IAugmentation<T, TData>
Type Parameters
TThe numeric type for calculations (e.g., float, double).
TDataThe data type being augmented (e.g., ImageTensor, AudioTensor).
Remarks
Augmentations are stochastic transformations applied during training to improve model generalization. Unlike preprocessing transforms, augmentations: - Produce different outputs for the same input (stochastic) - Are typically disabled during inference (training-only) - Have a probability of being applied - Can be composed in pipelines
For Beginners: Augmentation is like creating variations of your training data. If you're training an image classifier, flipping images horizontally gives the model more examples to learn from without collecting new data. This helps the model generalize better to new, unseen data.
Properties
IsEnabled
Gets whether this augmentation is currently enabled.
bool IsEnabled { get; set; }
Property Value
IsTrainingOnly
Gets whether this augmentation should only be applied during training.
bool IsTrainingOnly { get; }
Property Value
Remarks
Most augmentations are training-only. Test-Time Augmentation (TTA) uses specific augmentations during inference to improve predictions.
Name
Gets the name of this augmentation for logging and debugging.
string Name { get; }
Property Value
Probability
Gets the probability of this augmentation being applied (0.0 to 1.0).
double Probability { get; }
Property Value
Methods
Apply(TData, AugmentationContext<T>?)
Applies the augmentation to the input data.
TData Apply(TData data, AugmentationContext<T>? context = null)
Parameters
dataTDataThe input data to augment.
contextAugmentationContext<T>The augmentation context containing random state and targets.
Returns
- TData
The augmented data.
GetParameters()
Gets the parameters of this augmentation for serialization/logging.
IDictionary<string, object> GetParameters()
Returns
- IDictionary<string, object>
A dictionary of parameter names to values.