I am trying to train a Super Resolution GAN. Following some materials on the web I managed to train the first SRGAN model. To do that I took some high-resolution images (128x128 pixels) and downscale them to 32x32 to train the model. Once I finished the training of the model, I tested it using some new images that I didn't use for the training. Everything works fine if I used a 32x32 image, while the model does not work if I try to use a low-resolution image with a different shape with respect to 32 x32. Does anyone know if it is possible to use a model trained on a 32x32 low-resolution image to predict other images of arbitrary shape?

  • $\begingroup$ What do you mean with 'do not work if I try to use a low resoluation image'? Depending on the model architecture, the model could still work for images of different sizes. Sometimes the aspect ratio of the images will need to be the same, other times it will not but other constraints are applicable (i.e. number of pixels divisible by two). $\endgroup$
    – Oxbowerce
    Commented Apr 15, 2022 at 14:28
  • $\begingroup$ Thank you very much for your answer. When I try to use an images with a different size (with respect to 32x32) I receive this error "ValueError: Input 0 of layer "model" is incompatible with the layer: expected shape=(None, 32, 32, 3), found shape=(None, 212, 262, 3)". $\endgroup$ Commented Apr 15, 2022 at 14:39
  • $\begingroup$ What framework are you using for the creation/training of your network? Based on the error, I am assuming you are using keras. If that's indeed the case, you should be able to change the input shape of your network from (32, 32, 3) to (None, None, 3) to make the height and width variable. $\endgroup$
    – Oxbowerce
    Commented Apr 15, 2022 at 15:18
  • $\begingroup$ Thank you very much for your answer. Yes it is keras. I managed to find the input shape into the neural network and I changed as you suggested. Now it works. Thank you very much for your help. $\endgroup$ Commented Apr 21, 2022 at 9:26


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.