Albumentations is an open source computer vision package with which you can generate augmentated images. These images can be added to a training dataset. When the appropriate augmentations are chosen, augmented images can improve the performance of your model.
In this guide, we are going to show you how to use the
VerticalFlip
function in the Albumentations library to apply a
Vertical Flip
augmentation to images in your dataset.
To generate augmented images, we will:
1. Install Albumentations
2. Construct an image augmentation pipeline that uses the
Vertical Flip
augmentation
3. Generate augmented images using the pipeline
Without further ado, let's get started!
First, install the Albumentations pip package:
Once you have installed albumentations, you are ready to start generating augmented images.
Next, we are going to generate augmented images. We will define an augmentations pipeline with a single augmentation:
VerticalFlip
. We will then use this pipeline to generate augmented images. While we will only use one augmentation in this guide, you can stack augmentations if you want.
Create a new Python file and add the following code:
In this code, we:
You can customize the chance the augmentation is applied to an image by changing the p= argument from 1 to a value between 0 and 1.
You can update the code above to use a loop to augment multiple images.
Let's run our code on this image:
Here is an example of an image augmented with our code:
Our augmentation pipeline is now set up!
Now that you have augmented your images, your next step is to train a computer vision model.
Roboflow has several resources you can use to train vision models. Check out our training guides for more information:
- Train a YOLOv8 object detection model
- Train a YOLOv10 object detection model
- Train a PaliGemma object detection model
- Train a Florence-2 object detection model
If you are interested in learning more about training models for enterprise use cases, contact the Roboflow sales team.