Resize and save images dataset using fastai 2

Hey community!
Please help me with next question. I have an images dataset, let’s say 1200x1800 px. I don’t want to overload my CPU during learning process, so I want to save this dataset as 512x512 images.
Also I want to save it in 3 versions with different modes (Squish, Zeros, Crop) to test what works best for this dataset.

Does it possible with v2 library? Any example code for that?

Thanks in advance!

Hey! I don’t think there’s a built-in way to do this, but here’s a little notebook that uses fastai functionality to loop through a list of files, apply different modes of resizing, and save the resized images. You probably want to change the filename part, ie save the different methods in different folders for easy experimentation.

Hope that helps :slight_smile:

2 Likes

Thanks a lot! That’s enough to start with!