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.



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.


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

import albumentations as albu
from PIL import Image

transform =albu.RandomRotation(degrees=(-90,90))
augmented_image = transform(image=figure)['image']

# we have our required rotated 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%.