Open HappyLife-together opened 4 years ago
"input must be 4-dimensional[1,128,128]" My guess is that you are trying to apply to a grayscale image. However the default is for RBG (3 channels) image. Possible solutions can be found here: https://github.com/assafshocher/ZSSR/issues/15#issuecomment-552803800
iteration: 1050 reconstruct mse: 0.0011823893 , true mse: None sf: [2. 2.] , iteration: 1060 , loss: 0.027000174 slope: -1.1418480426072724e-08 STD: 1.9960531624398594e-08 learning rate updated: 1.0000000000000002e-06 Done training for sf= [2.0, 2.0] no kernel loaded ['E:\ZSSR/set14\img_003_SRF_2_LR_0.mat;', 'E:\ZSSR/set14\img_003_SRF_2_LR_1.mat;', 'E:\ZSSR/set14\img_003_SRF_2_LR_2.mat;', 'E:\ZSSR/set14\img_003_SRF_2_LR_3.mat;', 'E:\ ZSSR/set14\img_003_SRF_2_LR_4.mat;', 'E:\ZSSR/set14\img_003_SRF_2_LR_5.mat;'] *** 0 Start training for sf= [2.0, 2.0] * Traceback (most recent call last): File "D:\Anaconda3\envs\srtf\lib\site-packages\tensorflow\python\client\session.py", line 1278, in _do_call return fn(args) File "D:\Anaconda3\envs\srtf\lib\site-packages\tensorflow\python\client\session.py", line 1263, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "D:\Anaconda3\envs\srtf\lib\site-packages\tensorflow\python\client\session.py", line 1350, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: input must be 4-dimensional[1,128,128] [[Node: layer_1 = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], padding="SAME", strides=[1, 1, 1, 1], use_cudnn_ongpu=true, device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_lr_son_0_2, filter_0/read)]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "run_ZSSR.py", line 81, in
main(conf_str, gpu_str)
File "run_ZSSR.py", line 74, in main
run_ZSSR_single_input.main(input_file, ground_truth_file, kernel_files_str, gpu, conf_name, res_dir)
File "E:\ZSSR\run_ZSSR_single_input.py", line 25, in main
net.run()
File "E:\ZSSR\ZSSR.py", line 107, in run
self.train()
File "E:\ZSSR\ZSSR.py", line 316, in train
self.train_output = self.forward_backward_pass(self.lr_son, self.hr_father)
File "E:\ZSSR\ZSSR.py", line 221, in forward_backward_pass
feed_dict)
File "D:\Anaconda3\envs\srtf\lib\site-packages\tensorflow\python\client\session.py", line 877, in run
run_metadata_ptr)
File "D:\Anaconda3\envs\srtf\lib\site-packages\tensorflow\python\client\session.py", line 1100, in _run
feed_dict_tensor, options, run_metadata)
File "D:\Anaconda3\envs\srtf\lib\site-packages\tensorflow\python\client\session.py", line 1272, in _do_run
run_metadata)
File "D:\Anaconda3\envs\srtf\lib\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: input must be 4-dimensional[1,128,128]
[[Node: layer_1 = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], padding="SAME", strides=[1, 1, 1, 1], use_cudnn_ongpu=true,
device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_lr_son_0_2, filter_0/read)]]
Caused by op 'layer_1', defined at: File "run_ZSSR.py", line 81, in
main(conf_str, gpu_str)
File "run_ZSSR.py", line 74, in main
run_ZSSR_single_input.main(input_file, ground_truth_file, kernel_files_str, gpu, conf_name, res_dir)
File "E:\ZSSR\run_ZSSR_single_input.py", line 24, in main
net = ZSSR.ZSSR(input_img, conf, ground_truth, kernels)
File "E:\ZSSR\ZSSR.py", line 78, in init
self.build_network(conf)
File "E:\ZSSR\ZSSR.py", line 156, in buildnetwork
[1, 1, 1, 1], "SAME", name='layer%d' % (l + 1)))
File "D:\Anaconda3\envs\srtf\lib\site-packages\tensorflow\python\ops\gen_nn_ops.py", line 1042, in conv2d
data_format=data_format, dilations=dilations, name=name)
File "D:\Anaconda3\envs\srtf\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "D:\Anaconda3\envs\srtf\lib\site-packages\tensorflow\python\util\deprecation.py", line 454, in new_func
return func(*args, **kwargs)
File "D:\Anaconda3\envs\srtf\lib\site-packages\tensorflow\python\framework\ops.py", line 3155, in create_op
op_def=op_def)
File "D:\Anaconda3\envs\srtf\lib\site-packages\tensorflow\python\framework\ops.py", line 1717, in init
self._traceback = tf_stack.extract_stack()
InvalidArgumentError (see above for traceback): input must be 4-dimensional[1,128,128] [[Node: layer_1 = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], padding="SAME", strides=[1, 1, 1, 1], use_cudnn_ongpu=true, device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_lr_son_0_2, filter_0/read)]]