SRGAN icon indicating copy to clipboard operation
SRGAN copied to clipboard

Question about the channel of training images isn't 3

Open duxufeiqq opened this issue 7 years ago • 6 comments

duxufeiqq avatar Aug 28 '18 02:08 duxufeiqq

if i should train the model with images that don't have 3 channel , should i modify the files in tensorlayer or just change the main.py and model.py

duxufeiqq avatar Aug 28 '18 02:08 duxufeiqq

hi, @duxufeiqq , simply change the number of channel from 3 to your number then.

zsdonghao avatar Aug 28 '18 11:08 zsdonghao

thank you! i will have a try !

duxufeiqq avatar Aug 29 '18 02:08 duxufeiqq

have you done it?

Elwarfalli avatar May 27 '19 22:05 Elwarfalli

@zsdonghao I am getting this error when I change the channel from 3 to 1. any help

File "main.py", line 73, in train net_g = SRGAN_g(t_image, is_train=True, reuse=False) File "D:\PhD\PhD\Code\Python\Photo-Realistic Single Image SR Uing GAN\SRGAN-master\model.py", line 163, in SRGAN_d padding='SAME', W_init=w_init, name='h0/c') File "D:\PhD\PhD\Code\Python\Photo-Realistic Single Image SR Uing GAN\SRGAN-master\tensorlayer\layers.py", line 1880, in Conv2d name = name) File "D:\PhD\PhD\Code\Python\Photo-Realistic Single Image SR Uing GAN\SRGAN-master\tensorlayer\layers.py", line 1266, in init W = tf.get_variable(name='W_conv2d', shape=shape, initializer=W_init, **W_init_args ) File "C:\Users\hamed\Anaconda3\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 1479, in get_variable aggregation=aggregation) File "C:\Users\hamed\Anaconda3\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 1220, in get_variable aggregation=aggregation) File "C:\Users\hamed\Anaconda3\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 547, in get_variable aggregation=aggregation) File "C:\Users\hamed\Anaconda3\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 499, in _true_getter aggregation=aggregation) File "C:\Users\hamed\Anaconda3\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 853, in _get_single_variable found_var.get_shape())) ValueError: Trying to share variable SRGAN_d/h0/c/W_conv2d, but specified shape (4, 4, 3, 64) and found shape (4, 4, 1, 64).

Elwarfalli avatar May 27 '19 22:05 Elwarfalli

hello, you can now update the code base. this repo is updated to tf2.0.0a0 and tl2.

zsdonghao avatar Jun 05 '19 01:06 zsdonghao