If you have ever worked on a Computer Vision project, you might know that using augmentations to diversify the dataset is the best practice. On this page, we will:
Let's get into it!
Mosaic data augmentation combines 4 training images into one in random proportions. The algorithms is the following:
Mosaic augmentation teaches the model to recognize objects in different localizations without relying too much on one specific context. This boosts the model’s performance by making the algorithm more robust to the surroundings of the objects.
Using Mosaic can be really helpful if objects in your dataset:
Images of people, animals, electronic components, satellite imagery, and many others might be good examples.
However, using Mosaic might not yield significant improvement if your dataset consists of:
Hello, thank you for using the code provided by Hasty. Please note that some code blocks might not be 100% complete and ready to be run as is. This is done intentionally as we focus on implementing only the most challenging parts that might be tough to pick up from scratch. View our code block as a LEGO block - you can’t use it as a standalone solution, but you can take it and add to your system to complement it. If you have questions about using the tool, please get in touch with us to get direct help from the Hasty team.
# The formula for Alpha
xc = np.random.randint(x_center - x_center * self.alpha, x_center + x_center * self.alpha)
yc = np.random.randint(y_center - y_center * self.alpha, y_center + y_center * self.alpha)
As for now, the Albumentations library does not have a Mosaic transform function.
Still, if you want to use Mosaic, there are different implementations of this augmentation out on the Web. For example, please check out the GitHub repository featuring a ready-made Mosaic function you can straightaway use for your project.
With our new Accelerated Annotation offering, we can offer cost-effective AI without compromising on quality or speed.