Rotate
Rotate your training images
This tool further creates diversity in the training data by rotating some of your training images. The fraction of the images rotated depends on the probability of the rotation.

Parameters

Probability

This gives the probability of rotating an image. A higher probability will rotate more of the images. Hence it determines the fraction of the training data that would be rotated.

Range

All images aren't rotated to the same angle. For each image that is to be rotated, the angle is picked at random from a certain range specified by the user. The unit for the angle is in degrees.
A negative angle specifies a clockwise direction, whereas a positive angle is for a counter-clockwise direction.
Original Image
Image Rotated by 45 degrees

Code Implementation

1
import albumentations as albu
2
from PIL import Image
3
โ€‹
4
transform =albu.RandomRotation(degrees=(-90,90))
5
augmented_image = transform(image=figure)['image']
6
โ€‹
7
# we have our required rotated image in augmented_image.
Copied!

โ€‹

Further Resources

Last modified 2mo ago