Padding images

While dealing with images of various sizes , how should i pad images as in , the sizes of the images are different , the way it is oriented is different .
In such cases when i try to pad , it is uneven , the resulting images of the padding seems to be really different how to deal with this??

Hi Ashvanth,

IMO, it depends on the downstream task that you are trying to perform and how prominent is the region of interest that the task needs.

In classification, for example if your class label is very evident like it’s a full size image of a dog/cat, then you may choose to go with RandomResizedCrop.

If your class label is only present in a small section of the image, you may choose to go with Squish/Pad.

If the detail that you’re looking for is dependent on the aspect ratio of the image, then squish wouldn’t be a good alternative you’d better go with pad.

If you could share a few images then we would be able to give a better answer to your question I think. By default, there are all these methods implemented in fastai

You could refer the documentation here to learn more about these methods.



Well thanks a lot VInayak , initially i squish the images for the problem but later decided to pad and ended up having a better score . Guess everything boil downs to trial and error