Search code examples
pythontensorflowresolutioninferencetensor

Variable Resolution with Tensorflow for Superresolution


I am using tensorflow to scale images by a factor of 2. But since the tensor (batchsize, height, width, channels) determines the resolution it only accepts images of only one resolution for inference and training.

For other resolutions I have to modify the code and retrain the model. Is it possible to make my code resolution independent? In theory convolutions of images are resolution independent, I don't see a reason why this wouldn't be possible.

I have no idea how to do this in tensorflow though. Is there anything out there to help me with this?

Thanks


Solution

  • Okay so here is what I did:

    input and output tensors now have the shape (batchsize, None, None, channels)

    The training images now have to be resized outside of the network.

    Important reminder: training images have to be the same size since they are in batches! Images in one batch have to have the same size. When inferencing the batch size is 1 so the size does not matter.