Vertical Flip

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:

  • Сover the Vertical Flip augmentation;
  • Check out its parameters;
  • See how Vertical Flip affects an image;
  • And check out how to work with Vertical Flip using Python through the Albumentations library.

Let’s jump in.

Vertical Flip explained

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.

Image source

To define the term, Vertical Flip is a data augmentation technique that takes both rows and columns of such a matrix and flips them vertically. As a result, you will get an image flipped upside down along the x-axis.


  • Probability of applying transform - defines the likelihood of applying Vertical Flip to an image.
If a large fraction of training images needs to be flipped, set a high probability.

Horizontal Flip Vs. Vertical Flip

In the real world, people regularly confuse Horizontal and Vertical Flip as they feel alike. Still, there is a clear-cut difference:

  • Horizontal Flip flips an image along the y-axis;
  • Vertical Flip flips an image along the x-axis.
Image source

That is it. Keep this info in mind, and you will never find yourself stuck on a thought of which augmentation to choose.

For a deeper dive please check out our Horizontal Flip page.

Vertical Flip visualized

Original image
Image after Vertical Flip is applied

Code implementation

        import albumentations as albu
from PIL import Image
import numpy as np

transform = albu.augmentations.geometric.transforms.VerticalFlip
image = np.array('/some/random/image.png'))
augmented_image = transform(image=image)['image']

# We have the vertically flipped version of an initial image in augmented_image.

Learn more about other augmentations …

Last updated on Sep 23, 2022

Removing the risk from vision AI.

Only 13% of vision AI projects make it to production, with Hasty we boost that number to 100%.