jiangsutx / SRN-Deblur

Repository for Scale-recurrent Network for Deep Image Deblurring
http://www.xtao.website/projects/srndeblur/srndeblur_cvpr18.pdf
MIT License
720 stars 185 forks source link

ValueError: slice index 1 of dimension 1 out of bounds. for 'input/strided_slice_1' #39

Open lukasas74 opened 5 years ago

lukasas74 commented 5 years ago

Hello, I've tried using my own training photos, I've tried .jpg .png and nothing worked. Only GO Pro images worked. What I'm doing wrong? Changing datalist, everything.

jiangsutx commented 5 years ago

Maybe some if your images are too small. We cropped training images for training.

lukasas74 commented 5 years ago

Maybe some if your images are too small. We cropped training images for training.

I've tried training on larger images, could that be an issue? This is full code ValueError: slice index 1 of dimension 1 out of bounds. for 'input/strided_slice_1' (op: 'StridedSlice') with input shapes: [56,1], [2], [2], [2] and with computed input tensors: input[1] = <0 1>, input[2] = <0 2>, input[3] = <1 1>.

jiangsutx commented 5 years ago

Sorry I cannot locate the error in source code. You may find Line number for that error. In our code, you can find that we cropped input/GT images to form training data. You can try editing the crop size. And our images are all 3-channel color images. Did you mix gray images inside your data?

lukasas74 commented 5 years ago

I'm pasting whole traceback segment. (pythonGPU) C:\Deblur\SRN-Deblur-master\SRN-Deblur-master>python run_model.py --phase=train --batch=16 --lr=1e-4 --epoch=4000 WARNING:tensorflow:From C:\Users\home\Anaconda3\envs\pythonGPU\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. Traceback (most recent call last): File "C:\Users\home\Anaconda3\envs\pythonGPU\lib\site-packages\tensorflow\python\framework\ops.py", line 1659, in _create_c_op c_op = c_api.TF_FinishOperation(op_desc) tensorflow.python.framework.errors_impl.InvalidArgumentError: slice index 1 of dimension 1 out of bounds. for 'input/strided_slice_1' (op: 'StridedSlice') with input shapes: [56,1], [2], [2], [2] and with computed input tensors: input[1] = <0 1>, input[2] = <0 2>, input[3] = <1 1>.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "run_model.py", line 50, in tf.app.run() File "C:\Users\home\Anaconda3\envs\pythonGPU\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run _sys.exit(main(argv)) File "run_model.py", line 44, in main deblur.train() File "C:\Deblur\SRN-Deblur-master\SRN-Deblur-master\models\model.py", line 183, in train self.build_model() File "C:\Deblur\SRN-Deblur-master\SRN-Deblur-master\models\model.py", line 134, in build_model img_in, img_gt = self.input_producer(self.batch_size) File "C:\Deblur\SRN-Deblur-master\SRN-Deblur-master\models\model.py", line 57, in input_producer in_list = List_all[:, 1] File "C:\Users\home\Anaconda3\envs\pythonGPU\lib\site-packages\tensorflow\python\ops\array_ops.py", line 654, in _slice_helper name=name) File "C:\Users\home\Anaconda3\envs\pythonGPU\lib\site-packages\tensorflow\python\ops\array_ops.py", line 820, in strided_slice shrink_axis_mask=shrink_axis_mask) File "C:\Users\home\Anaconda3\envs\pythonGPU\lib\site-packages\tensorflow\python\ops\gen_array_ops.py", line 9356, in strided_slice shrink_axis_mask=shrink_axis_mask, name=name) File "C:\Users\home\Anaconda3\envs\pythonGPU\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper op_def=op_def) File "C:\Users\home\Anaconda3\envs\pythonGPU\lib\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func return func(*args, **kwargs) File "C:\Users\home\Anaconda3\envs\pythonGPU\lib\site-packages\tensorflow\python\framework\ops.py", line 3300, in create_op op_def=op_def) File "C:\Users\home\Anaconda3\envs\pythonGPU\lib\site-packages\tensorflow\python\framework\ops.py", line 1823, in init control_input_ops) File "C:\Users\home\Anaconda3\envs\pythonGPU\lib\site-packages\tensorflow\python\framework\ops.py", line 1662, in _create_c_op raise ValueError(str(e)) ValueError: slice index 1 of dimension 1 out of bounds. for 'input/strided_slice_1' (op: 'StridedSlice') with input shapes: [56,1], [2], [2], [2] and with computed input tensors: input[1] = <0 1>, input[2] = <0 2>, input[3] = <1 1>.

I've tried recreating this error with GOPRO images from dataset. I've tried getting data list using cmd dir/b/s *.jpg >datalist_gopro.txt command and this error accured. Then I've switched to original datalist... txt and it began working. Maybe I was generating datalist in wrong workflow? And I use only color for training.

jiangsutx commented 5 years ago

Yes. Please make sure the paths are correct. TensorFlow is hard to debug the data pipeline.

You can separately test the data input part: https://github.com/jiangsutx/SRN-Deblur/blob/master/models/model.py#L37-L63 And make sure data files can be correctly located.