Customized data augmentation

I was looking for customized data augmentation for image data set that I have and found this:

This would be great to start as @ptrblck pointed. However, I am looking to the clean method to augment data to the certain number of images, let’s say 5000 images per each class. I have various distribution of data across all classes, from 200 to 1000, so I have to augment some classes more than others. Is there any way to do so?


First of all, we can select the classes that we have to focus on (minority classes for imbalanced dataset), then we can define a list of transformations for the selected classes and give the probability values for each individual transformations, like for classes that are very rare, we should augment them for 90 percent (for example) of the cases, and others that are in majority, augment them for only 10 percent (for example) of the cases, and so on. In this way, in the custom dataset class that we created, we can iterate on the classes and pass the predefined transformations with certain probability values, and apply on those classes/labels.