我使用tf.random_crop()
在我的补丁(80,80)中裁剪56 * 56。patch = tf.random_crop(patch, [56, 56, 3])
我收到如下错误:
Caused by op u'random_crop', defined at:
File "train.py", line 73, in <module>
main()
File "train.py", line 26, in main
low_res_batch, high_res_batch = batch_queue_for_training(TRAINING_DATA_PATH)
File "/data/code/super_resolution/anima2x/src/data_inputs.py", line 26, in batch_queue_for_training
high_res_patch = tf.random_crop(patch, [LABEL_SIZE, LABEL_SIZE, NUM_CHENNELS])
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/random_ops.py", line 322, in random_crop
return array_ops.slice(value, offset, size, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 484, in slice
return gen_array_ops._slice(input_, begin, size, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 2868, in _slice
name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 759, in apply_op
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2240, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1128, in __init__
self._traceback = _extract_stack()
InvalidArgumentError (see above for traceback): Expected size[0] in [0, 38], but got 56
[[Node: random_crop = Slice[Index=DT_INT32, T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/gpu:0"](Reverse, random_crop/mod, random_crop/size)]]
[[Node: case/If_1/ResizeArea/images/_67 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_150_case/If_1/ResizeArea/images", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]()]]
我不知道为什么预期的大小必须在[0,some_num小于56],任何人都可以帮忙解决它吗?