assafshocher / ZSSR

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

I am trying to execute your code. The error is - Invalid Argument Error. Please help me in solving this. Detail error is below. #16

Open 2karthikbhat opened 4 years ago

2karthikbhat commented 4 years ago

I am using 2272271 gray scale images as test images.

no kernel loaded kernel_files *** 0 WARNING:tensorflow:From C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating: Colocations handled automatically by placer. WARNING:tensorflow:From C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\python\util\tf_should_use.py:193: initialize_all_variables (from tensorflow.python.ops.variables) is deprecated and will be removed after 2017-03-02. Instructions for updating: Use tf.global_variables_initializer instead. 2019-12-02 15:04:22.376582: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 Start training for sf= [2.0, 2.0] * 2019-12-02 15:04:22.481045: W tensorflow/core/framework/op_kernel.cc:1401] OP_REQUIRES failed at conv_ops.cc:437 : Invalid argument: input must be 4-dimensional[1,128,128] Traceback (most recent call last): File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1334, in _do_call return fn(args) File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1319, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1407, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: input must be 4-dimensional[1,128,128] [[{{node layer_1}}]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "run_ZSSR.py", line 75, in main(conf_str, gpu_str) File "run_ZSSR.py", line 69, in main run_ZSSR_single_input.main(input_file, ground_truth_file, kernel_files_str, gpu, conf_name, res_dir) File "D:\Python\ZSSR-master\run_ZSSR_single_input.py", line 25, in main net.run() File "D:\Python\ZSSR-master\ZSSR.py", line 107, in run self.train() File "D:\Python\ZSSR-master\ZSSR.py", line 313, in train self.train_output = self.forward_backward_pass(self.lr_son, self.hr_father) File "D:\Python\ZSSR-master\ZSSR.py", line 221, in forward_backward_pass feed_dict) File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 929, in run run_metadata_ptr) File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1152, in _run feed_dict_tensor, options, run_metadata) File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1328, in _do_run run_metadata) File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1348, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: input must be 4-dimensional[1,128,128] [[node layer_1 (defined at D:\Python\ZSSR-master\ZSSR.py:156) ]]

Caused by op 'layer_1', defined at: File "run_ZSSR.py", line 75, in main(conf_str, gpu_str) File "run_ZSSR.py", line 69, in main run_ZSSR_single_input.main(input_file, ground_truth_file, kernel_files_str, gpu, conf_name, res_dir) File "D:\Python\ZSSR-master\run_ZSSR_single_input.py", line 24, in main net = ZSSR.ZSSR(input_img, conf, ground_truth, kernels) File "D:\Python\ZSSR-master\ZSSR.py", line 78, in init self.build_network(conf) File "D:\Python\ZSSR-master\ZSSR.py", line 156, in buildnetwork [1, 1, 1, 1], "SAME", name='layer%d' % (l + 1))) File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\python\ops\gen_nn_ops.py", line 1112, in conv2d data_format=data_format, dilations=dilations, name=name) File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper op_def=op_def) File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func return func(*args, **kwargs) File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 3300, in create_op op_def=op_def) File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1801, in init self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): input must be 4-dimensional[1,128,128] [[node layer_1 (defined at D:\Python\ZSSR-master\ZSSR.py:156) ]]

assafshocher commented 4 years ago

Hi pls check #15 , it seems your problem is due to using a grayscale image.