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.
Hello, thank you for using the code provided by Hasty. Please note that some code blocks might not be 100% complete and ready to be run as is. This is done intentionally as we focus on implementing only the most challenging parts that might be tough to pick up from scratch. View our code block as a LEGO block - you can’t use it as a standalone solution, but you can take it and add to your system to complement it. If you have questions about using the tool, please get in touch with us to get direct help from the Hasty team.
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.
Automate 90% of the work, reduce your time to deployment by 40%, and replace your whole ML software stack with our platform.
Start for free Request a demo