How to set upsampling rate if the ratio is not an integer?

In the lab 2, we use an upsampling ratio of (7, 7) as 224/32 = 7.
But what would you do in you hav for example an images of 40x40?
So 224/40 = 5.6, do you use 5 or 6 as upsampling ratio or do you rezise your 40x40 images to 32x32 before upsampling?
I tried to google for suggestions wht would be the best way, but I did not find any answer

I think if you have 40x40 image, you can always rescale your image according to your batch size in the image regenerator. But one needs to understand here the factor used is based on image transformation. Read the below line from the same lab you have mentioned.

Since input image size is (32 x 32), first upsample the image by factor of (7x7) to transform it to (224 x 224)
Connect the feature extraction and â€śclassifierâ€ť layers to build the model

So 40x40, first upsampling image by factor of (nxn) to transform it to (nxn)
40x40, first upsampling image by factor of 6x6 to transform it to 240x240

so you can always get an float variable and not an integer

Regards
DP

1 Like