# Resizing images for training with Mobilenets

I have a script to download images, but the images are of different resolutions so I have written a script to shrink the image. I have two options:

size=(224,224)


with cv2

cv2.resize(img,size,interpolation=cv2.INTER_AREA)


with PIL

img.thumbnail(size,Image.ANTIALIAS)


after saving them I see cv2 doesn't maintain the original ratio where as PIL maintains the ratio.

My question :

1. Maintaining aspect ratio is important or not.

2. If yes (224,224) is a good choice or should I set it to higher resolution.

Sorry if the question is naive, I am new to image processing.

• Would you mind putting both images? – Media May 28 '18 at 15:45

Depending on your task 224 may be good or not. In typical classification networks, it is an acceptable size, like the inputs of AlexNet or VGG and such customary nets. For localization tasks, not really. For instance, the input height and width of YOLO is more than that 1.