Skip to content

Commit

Permalink
Augmentation work
Browse files Browse the repository at this point in the history
  • Loading branch information
kartikdutt18 committed May 31, 2020
1 parent cca7a1b commit f0def62
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions augmentation/augmentation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ class Augmentation
/**
* Constructor for augmentation class.
*
* @param augmentation List of strings containing one of the supported
* @param augmentations List of strings containing one of the supported
* augmentation.
* @param augmentationProbability Probability of applying augmentation on
* the dataset.
* NOTE : This doesn't apply to augmentations
* such as resize.
*/
Augmentation(const std::vector<std::string>& augmentation,
Augmentation(const std::vector<std::string>& augmentations,
const double augmentationProbability);

/**
Expand Down
15 changes: 15 additions & 0 deletions augmentation/augmentation_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,19 @@ Augmentation::Augmentation() :
{
// Nothing to do here.
}

Augmentation::Augmentation(const std::vector<std::string>& augmentations,
const double augmentationProbability) :
augmentations(augmentations),
augmentationProbability(augmentationProbability)
{
// Sort the vector to place resize parameter to the front of the string.
// This prevents constant look ups for resize.
sort(this->augmentations.begin(), this->augmentations.end(), [](
std::string& str1, std::string& str2)
{
return str1.find("resize") != std::string::npos;
});
}

#endif

0 comments on commit f0def62

Please sign in to comment.