How does the learner handle a change in data resolution?

From the superres tutorial, after training on an initial databunch, it’s shown that the resolution of the image is doubled

data = get_data(12,size*2)
learner.data = data

The learner is then able to train and infer at the new resolution. I’m confused how the resolution size change was handled. Is the underlying model changed at all? Or is it managed by the adaptive layers automatically? Or something happening in the learner

I tried inferring directly after changing the learner.data to the higher res and the inference gives good results straight away without extra training. How does the model know how to infer well at the higher res without examples?

The pooling layer used in the underlying model is “adaptive”, meaning it always results in the same shape regardless of the input resolution. For instance, if there are 512 channels in the final convolution, no matter what the spatial dimensions are, the result will be a 512-dimensional vector which is then fed to a linear layer to make predictions, assuming your task is object detection (in the case of fastai, 1024-dimensional since it concatenates two pooling operations).

Hope that helps!

2 Likes

This assumes those detects and gaps exist in the training data for their Many deep learning super resolution methods can’t be applied universally to all types of image changing the quality reduction and noise to be random for each image.
tellpizzahut