Pad + Random Crop

I have a series of images with size 178 × 218 and I was wondering how to pad them and randomly crop them in a way that it doesn’t eliminate any of the interesting parts of my image (which are normally at the center) for the task I’m doing.

Hello,

I believe RandomCrop is the transformation you are looking for (part of torchvision). If you are not familiar with torchvisions’s transforms, I suggest that you look at the following tutorial.

1 Like