【发布时间】:2016-03-08 15:34:18
【问题描述】:
我有一个 CSV 文件,其中包含成对的图像文件名和标签。我想加载这些图片。
# Queue for reading input pairs
filename_queue = tf.train.string_input_producer([MY_CSV_FILE])
# Read CSV input pairs and label
pair_list_reader = tf.TextLineReader()
pair_list_key, pair_list_value = pair_list_reader.read(filename_queue)
record_defaults = [[''], [''], [-1]]
img1_path, img2_path, label = tf.decode_csv(pair_list_value, record_defaults=record_defaults)
# Load image 1
img1_filename_queue = tf.train.string_input_producer(img1_path)
如您所见,我逐行读取 CSV 文件,然后尝试使用从 CSV 解码器获得的文件名初始化第二个输入生成器。
我在最后一行得到一个错误,但是:
File "tensorflow/python/training/input.py", line 138, in string_input_producer
"fraction_of_%d_full" % capacity)
File "tensorflow/python/training/input.py", line 106, in _input_producer
enq = q.enqueue_many([input_tensor])
File "tensorflow/python/ops/data_flow_ops.py", line 192, in enqueue_many
batch_dim = ret.inputs[1].get_shape()[0]
File "tensorflow/python/framework/tensor_shape.py", line 427, in __getitem__
return self._dims[key]
IndexError: list index out of range
这是为什么呢?
提前谢谢你。
【问题讨论】:
标签: python tensorflow