I think this is mentioned in the fastai docs here
specifically note this excerpt:
You can also decide how your images are put to the final size by specifying a resize_method
. By default, the library resize the image while keeping its original ratio so that the smaller size corresponds to the given size, then takes a crop ( ResizeMethod.CROP
). You can choose to resize the image while keeping its original ratio so that the bigger size corresponds to the given size, then take a pad ( ResizeeMethod.PAD
). Another way is to just squish the image to the given size ( ResizeeMethod.SQUISH
).
_,axs = plt.subplots(1,3,figsize=(9,3))
for rsz,ax in zip([ResizeMethod.CROP, ResizeMethod.PAD, ResizeMethod.SQUISH], axs):
get_ex().apply_tfms([crop_pad()], size=224, resize_method=rsz, padding_mode='zeros').show(ax=ax, title=rsz.name.lower())