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 jump in.
As you might know, every image can be viewed as a matrix of pixels, with each pixel containing some specific information, for example, color or brightness.
To define the term, Horizontal Flip is a data augmentation technique that takes both rows and columns of such a matrix and flips them horizontally. As a result, you will get an image flipped horizontally along the y-axis.
In the real world, people regularly confuse Horizontal and Vertical Flip as they feel alike. Still, there is a clear-cut difference:
That is it. Keep this info in mind, and you will never find yourself stuck on a thought of which augmentation to choose.
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.
import albumentations as albu
from PIL import Image
import numpy as np
transform =albu.HorizontalFlip(p=0.5)
image = np.array(Image.open('/some/random/image.png'))
augmented_image = transform(image=image)['image']
# we have our required flipped image in augmented_image.
Hasty is a unified agile ML platform for your entire Vision AI pipeline — with minimal integration effort for you.
Start for free Check out our services