1

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?

Pluviophile
  • 3,808
  • 13
  • 31
  • 54
  • 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). – Oxbowerce Apr 15 '22 at 14:28
  • 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)". – MattiaMartinelli Apr 15 '22 at 14:39
  • 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. – Oxbowerce Apr 15 '22 at 15:18
  • 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. – MattiaMartinelli Apr 21 '22 at 09:26

0 Answers0