Write custom directory title here
Mosaic data augmentation
Mosaic data enhancement, random cropping of pictures, zooming and arranging them into one picture, enriching data sets, adding small sample targets, and improving network training speed.
Turn Mosaic3 into Mosaic9
The data augmentation code is found in utils/dataloaders.py
mosaic = self.mosaic and random.random() < hyp['mosaic']
if mosaic:
# Load mosaic
img, labels = load_mosaic(self, index) # use load_mosaic4
shapes = None
# MixUp augmentation
if random.random() < hyp['mixup']:
img, labels = mixup(img, labels, *load_mosaic(self, random.randint(0, self.n - 1)))
Put one of these:
img, labels = load_mosaic(self, index)
Change to:
img, labels = load_mosaic9(self, index)
Then:
img, labels = mixup(img, labels, *load_mosaic(self, random.randint(0, self.n - 1)))
Change to:
img, labels = mixup(img, labels, *load_mosaic9(self, random.randint(0, self.n - 1)))
Change these two places, you can change Mosaic to Mosaic9