NEW
All annotation is now free in Hasty.

Horizontal Flip

This data augmentation allows you to horizontally flip images with a certain probability.

Parameters

Probability

This produces the probability of horizontally flipping each image.

Original image
Horizontally flipped Image

If a large fraction of training images needs to be flipped, set a high probability.

Code Implementation


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.

Further Resources

Last updated on Jun 01, 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%.