Clarification about albumentations implementation? #2118
-
I'm working on applying data augmentation to increase the size of my dataset. I can gather from the documentation how to use the "augmentors" or "aug_transform" parameters for SematicSegmentationGeoDataConfig. I am confused about how these transformations affect the total size of the dataset. If I specify one augmentor, then is my dataset size doubled to include both the original dataset and the transformed dataset, or do we only get the transformed dataset? Say I am using two transformations, A and B. I wish to quadruple my dataset by using the original dataset, the dataset transformed by A, the dataset transformed by B, and the dataset transformed by both A and B. Would I need to create four different datasets and stack them? How could I best go about that? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The way data augmentation works (in both RV and in general) is that when sampling an image, each augmentation is applied with some probability. So if you train for multiple epochs, the same image will show up with a different combination of transforms applied each time. Training with such transformations is theoretically equivalent to augmenting the dataset with these transformed samples. The size of the dataset (in the E.g. if the transform is: tf = A.Compose([
A.HorizontalFlip(p=0.5),
A.VerticalFlip(p=0.5),
]) You can imagine the sampled image going through each transform in this pipeline one by one and each being applied with the specified probability. So, in this case, all four possible combinations of transforms will occur with probability 0.25. I would recommend playing around with datasets and transforms in a notebook to get a feel for what the sampled data looks like before using them for training. |
Beta Was this translation helpful? Give feedback.
The way data augmentation works (in both RV and in general) is that when sampling an image, each augmentation is applied with some probability. So if you train for multiple epochs, the same image will show up with a different combination of transforms applied each time. Training with such transformations is theoretically equivalent to augmenting the dataset with these transformed samples. The size of the dataset (in the
len(ds)
sense) does not change.E.g. if the transform is:
You can imagine the sampled image going through each transform in this pipeline one by one and each being applied with the specified probabilit…