Class Augmentation

Class Documentation

class mlpack::models::Augmentation

Augmentation class used to perform augmentations by transforming the data. For the list of supported augmentation, take a look at our wiki page.

Augmentation augmentation({"horizontal-flip", "resize = (224, 224)"}, 0.2);
augmentation.Transform(dataloader.TrainFeatures);

Public Functions

inline Augmentation()

Create the augmentation class object.

inline Augmentation(const std::vector<std::string> &augmentations, const double augmentationProbability)

Constructor for augmentation class.

Parameters
  • augmentations – List of strings containing one of the supported augmentations.

  • augmentationProbability – Probability of applying augmentation on the dataset. NOTE : This doesn’t apply to augmentations such as resize.

template<typename DatasetType>
void Transform(DatasetType &dataset, const size_t datapointWidth, const size_t datapointHeight, const size_t datapointDepth = 1)

Applies augmentation to the passed dataset.

Template Parameters

DatasetType – Datatype on which augmentation will be done.

Parameters
  • dataset – Dataset on which augmentation will be applied.

  • datapointWidth – Width of a single data point i.e. Since each column represents a seperate data point.

  • datapointHeight – Height of a single data point.

  • datapointDepth – Depth of a single data point. For one 2-dimensional data point, set it to 1. Defaults to 1.

template<typename DatasetType>
void ResizeTransform(DatasetType &dataset, const size_t datapointWidth, const size_t datapointHeight, const size_t datapointDepth, const std::string &augmentation)

Applies resize transform to the entire dataset.

Template Parameters

DatasetType – Datatype on which augmentation will be done.

Parameters
  • dataset – Dataset on which augmentation will be applied.

  • datapointWidth – Width of a single data point i.e. Since each column represents a seperate data point.

  • datapointHeight – Height of a single data point.

  • datapointDepth – Depth of a single data point. For one 2-dimensional data point, set it to 1. Defaults to 1.

  • augmentation – String containing the transform.