If you have ever worked on a Computer Vision project, you might know that using augmentations to diversify the dataset is the best practice. On this page, we will:

  • Сover the Resize augmentation;

  • Check out its parameters;

  • See how Resize affects an image;

  • And check out how to work with Resize using Python through the Albumentations library.

Let’s get into it!

As the name suggests, this data augmentation changes the size of your image according to the set height and width parameters.

  • Height after resize - sets the height of the resized image in pixels;

  • Width after resize - sets the width of the resized image in pixels.

Original image (before Resize)
Source
Image after Resize was applied
Source
python
      import albumentations as albu
from PIL import Image

transform = albu.augmentations.geometric.resize.Resize(200,200)
augmented_image = transform(image=figure)['image']

# We have the resized image in augmented_image.
    

Boost model performance quickly with AI-powered labeling and 100% QA.

Learn more
Last modified