assafshocher / ZSSR

"Zero-Shot" Super-Resolution using Deep Internal Learning
Other
399 stars 102 forks source link

Issue whit X2_GRADUAL_IDEAL_CONF #5

Open NoushNabi opened 5 years ago

NoushNabi commented 5 years ago

Hello Assaf,

"python run_ZSSR.py" runs perfectly but I got the below message when I was running "python run_ZSSR.py X2_GRADUAL_IDEAL_CONF". Would you please help me to debug it? Thanks a lot.

Traceback (most recent call last): File "run_ZSSR.py", line 79, in main(conf_str, gpu_str) File "run_ZSSR.py", line 73, in main run_ZSSR_single_input.main(input_file, ground_truth_file, kernel_files_str, gpu, conf_name, res_dir) File "/home/nnabizad/workspace/SR/ZSSR/ZSSR-master/run_ZSSR_single_input.py", line 25, in main net.run() File "/home/nnabizad/workspace/SR/ZSSR/ZSSR-master/ZSSR.py", line 107, in run self.train() File "/home/nnabizad/workspace/SR/ZSSR/ZSSR-master/ZSSR.py", line 311, in train self.train_output = self.forward_backward_pass(self.lr_son, self.hr_father) File "/home/nnabizad/workspace/SR/ZSSR/ZSSR-master/ZSSR.py", line 221, in forward_backward_pass feed_dict) File "/home/nnabizad/.conda/envs/nooshEnv35/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 877, in run run_metadata_ptr) File "/home/nnabizad/.conda/envs/nooshEnv35/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1100, in _run feed_dict_tensor, options, run_metadata) File "/home/nnabizad/.conda/envs/nooshEnv35/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1272, in _do_run run_metadata) File "/home/nnabizad/.conda/envs/nooshEnv35/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1291, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: transpose expects a vector of size 3. But input(1) is a vector of size 4 [[Node: gradients/layer_1_grad/Conv2DBackpropFilter-0-TransposeNHWCToNCHW-LayoutOptimizer = Transpose[T=DT_FLOAT, Tperm=DT_INT32, _device="/job:localhost/replica:0/task:0/device:GPU:0"](_arg_lr_son_0_2/_3, PermConstNHWCToNCHW-LayoutOptimizer)]] [[Node: Mean/_13 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_326_Mean", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]

assafshocher commented 5 years ago

Hi, It looks like you are running it with python3 while this project is for python2. There are several forks of this project that converted to python3 that you may want to check out (I didn't check any of them). Good luck!

NoushNabi commented 5 years ago

Thanks a lot for your reply.

ThisGame42 commented 5 years ago

Hi,

I have exactly the same issue and I am unfortunately having troubles understanding @assafshocher 's remarks regarding to the usage of python3. I've used conda to set up a virtual environment for python 2, and I have explicitly used python 2 to execute your script as follow:

python2  run_ZSSR.py X2_GRADUAL_IDEAL_CONF

However, this issue is still present to me when I try to run the network on grayscale images. RGB images on the other hand work fine with the script.

Could you please elaborate a bit more on the cause of this issue here?

Thanks very much, JZ

ThisGame42 commented 5 years ago

I've figured out how to resolve this issue so I thought I'd put the solution down to save everyone a bit of time.

If you can't run ZSSR on a gray scale image, you could try load it into memory and save it as a RGB image with each channel (r g and b) being identical. You should now be able to run ZSSR on that image.

Cheers, JZ