Horizontal Flipping Consistency and background augmentation for semantic segmentation

Hi PyTorch cummunity

I’m doing semantic segmentation on a facial dataset (HELEN) with classes “background”, “skin”, “hair”, “nose”, “left eye”, “right eye”, and other facial classes. See this paper for an example of work on this dataset: https://arxiv.org/abs/1906.01342

I have a training set of 2000 images and I’d like to do random flipping as an augmentation. I have “left eye” and “right eye” but would like to keep the integers consistent when the flipping is done on left/right classes due to my research. My first question, is it okay to just duplicate the training data so I have 4000 images where half are flipped with the left/right integers swapped too?

My second question, is there a way to do online augmentation with PyTorch/torchvision transforms?

On another note, the paper above uses an augmentation where they randomly replace the background classed pixels with “non-face images or pure colors”. Does anyone know any good tools for doing something like that with pytorch?

Input is much appreciated :slight_smile: