8x upsampling possible?
Hi, I'd like to train the network on a, 8x down-sampled input/full resolution reference, data set. Is this possible? What modifications are necessary. Thanks a lot.
modify the model and data
Can you please be more specific?
for model, add two more sub-pixel convolutional layers. for data, down-sampled the images by 8
Ok thanks a lot, so after I add those layers, do I need to add any other plumbing, do I need to change some globals somewhere do use 8 instead of 4?
On Sat, Mar 3, 2018 at 9:59 AM, Hao [email protected] wrote:
for model, add two more sub-pixel convolutional layers. for data, down-sampled the images by 8
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tensorlayer/srgan/issues/65#issuecomment-370167089, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ-yE4WZx84i-n8lUP-6v3NdhIoa_sZHks5tatoHgaJpZM4SagsO .
@artificialskills did you managed to make it work?
@perdigas91 I didn't try yet, but I'm going to see if I can swing back around and work on it soon, let you know.
Do we need to have different pretrained model for different scale ? like 2x,3x,4x? or, 1 pre-trained model works with other scales ?
same question with rahat-yasir, if I want to train on my dataset with downsampling factor 2, what modifications (model, parameters, etc) should I make? Thanks!
@rahat-yasir You need a new model for every scale. @cauivy Adjust model.py by removing one scaling layer
#n = Conv2d(n, 256, (3, 3), (1, 1), act=None, padding='SAME', W_init=w_init, name='n256s1/2')
#n = SubpixelConv2d(n, scale=2, n_out_channel=None, act=tf.nn.relu, name='pixelshufflerx2/2')
In main.py adjust the placeholder variables to fit your desired in and output
t_image = tf.placeholder('float32', [batch_size, 192, 192, 3], name='t_image_input_to_SRGAN_generator')
t_target_image = tf.placeholder('float32', [batch_size, 384, 384, 3], name='t_target_image')
And in utils.py adjust the downsample function
x = imresize(x, size=[192, 192], interp='bicubic', mode=None)
This should be it. Maybe i missed something but don't worry you will get an error if so :)
Thank you very much for your reply!
@artificialskills To also answer the original question. For 8x upscaling you do it similar, instead of removing a scaling layer you add one. You probably also have to adjust the number of filters in the conv2d layers.
i tried for the 4x upscaling the same program but it throws me alot of exception which i am unable to handle any suggestion
I tried 2x upscaling and I found the computation speed is very slow. Is that because the network dimension is 4 times larger than 4x scale's network? Thanks!!!
@Obliviously
Thank you for sharing the very concise implementation. I am working on a dataset where the image scale factor from HR/LR is 1.5 and 2.25.
I am having a hard wrapping my head around how would I get it to work on these data.
I am limited as the original HR images are in 4:3 aspect ratio and need to be upsampled in the same aspect ratio ..
Any thoughts on how this would come across in the SRGAN model ?
As far as I know you can't do floating point scaling with the given layers. The easiest way of doing it would be to scale it to the the next integer factor and then do a simple bicubic downscaling to your desired size.
The aspect ratio doesnt really matter, because (during training) SRGAN is cropping the image anyway. So this shouldnt concern you.
Hi, also a similar question. I'm working on upscaling by 3x. I have altered my downsample function in utils.py to be
x = imresize(x, size=[144, 144], interp='bicubic', mode=None)
I'm struggling to understand how to change the model to cope with 3x, and what changes need to be made in main.py to account for this. Thanks!!
@rahat-yasir You need a new model for every scale. @cauivy Adjust model.py by removing one scaling layer
#n = Conv2d(n, 256, (3, 3), (1, 1), act=None, padding='SAME', W_init=w_init, name='n256s1/2') #n = SubpixelConv2d(n, scale=2, n_out_channel=None, act=tf.nn.relu, name='pixelshufflerx2/2')In main.py adjust the placeholder variables to fit your desired in and output
t_image = tf.placeholder('float32', [batch_size, 192, 192, 3], name='t_image_input_to_SRGAN_generator') t_target_image = tf.placeholder('float32', [batch_size, 384, 384, 3], name='t_target_image')And in utils.py adjust the downsample function
x = imresize(x, size=[192, 192], interp='bicubic', mode=None)This should be it. Maybe i missed something but don't worry you will get an error if so :)
Hi @Obliviously I am getting this error when I follow your steps to retrain the model to get 2x: any help, please
ValueError: Dimension 0 in both shapes must be equal, but are 1 and 3. Shapes are [1,1,64,3] and [3,3,64,256]. for 'Assign_169' (op: 'Assign') with input shapes: [1,1,64,3], [3,3,64,256].