使用tensorflow 输入队列读取 文件一行 时报错

input_queue = tf.train.string_input_producer([filenames_file], shuffle=False)
line_reader = tf.TextLineReader()
_, line = line_reader.read(input_queue)
split_line = tf.string_split([line]).values
center_image_path = tf.string_join([self.data_path, '/',split_line[0]])
top_image_path = tf.string_join([self.data_path,'/', split_line[1]])
bottom_image_path = tf.string_join([self.data_path,'/', split_line[2]])
horizonal_image_path0 = tf.string_join([self.data_path,'/', split_line[3]])
horizonal_image_path1 = tf.string_join([self.data_path,'/', split_line[4]]

2018-10-08 20:26:26.408728: W tensorflow/core/framework/op_kernel.cc:1318] OP_REQUIRES failed at strided_slice_op.cc:105 : Invalid argument: slice index 0 of dimension 0 out of bounds.
2018-10-08 20:26:26.408813: W tensorflow/core/framework/op_kernel.cc:1318] OP_REQUIRES failed at strided_slice_op.cc:105 : Invalid argument: slice index 3 of dimension 0 out of bounds.
2018-10-08 20:26:26.408830: W tensorflow/core/framework/op_kernel.cc:1318] OP_REQUIRES failed at strided_slice_op.cc:105 : Invalid argument: slice index 4 of dimension 0 out of bounds.
2018-10-08 20:26:26.408843: W tensorflow/core/framework/op_kernel.cc:1318] OP_REQUIRES failed at strided_slice_op.cc:105 : Invalid argument: slice index 2 of dimension 0 out of bounds.
2018-10-08 20:26:26.408857: W tensorflow/core/framework/op_kernel.cc:1318] OP_REQUIRES failed at strided_slice_op.cc:105 : Invalid argument: slice index 1 of dimension 0 out of bounds.

这种情况是因为读取txt 文件一行时进行切片,有可能是你一中切片后的数据不够导致的。这时候应该检查队列读取的文件是否生成有误。

猜你喜欢

转载自blog.csdn.net/guanxing_zhou/article/details/82978264