Q:

how does tensorflow retraining last layer handle different image sizes?

I am running the tensorflow retrain tutorial but i cannot understand why the retrain images can be a different size from the images the model was originally trained on.  I looked into the retrain.py script that feeds the images to the model but the code is not doing any kind of image resizing, it is directly reading the image from disk and immediately feeds it to the model.
Does anyone know how it can be using different sized images when doing last-layer training?

A:

Technically, the Inception models can be directly applied to a wide range of image sizes. This is possible because the last average-pooling before the dense layer is a global average-pool (rather than 3x3 or 2x2):
From https://github.com/tensorflow/models/blob/master/inception/inception/slim/inception_model.py#L320 :
      shape = net.get_shape()
      net = ops.avg_pool(net, shape[1:3], padding='VALID', scope='pool')

This specifies the window of the pooling to be the whole image.
In other words, that pooling layer averages the features across the spatial dimensions, so H x W x 2048 becomes 1 x 1 x 2048 regardless of H and W.

That said, in my experience, applying NNs at scales very different from how they were trained may cause some fall-off in accuracy (But the network should work)

