Horizontal Flip
Augments your data by flipping it horizontally.
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

1
import albumentations as albu
2
from PIL import Image
3
import numpy as np
4
โ€‹
5
transform =albu.HorizontalFlip(p=0.5)
6
image = np.array(Image.open('/some/random/image.png'))
7
augmented_image = transform(image=image)['image']
8
โ€‹
9
# we have our required flipped image in augmented_image.
Copied!

Further Resources

Last modified 2mo ago