从tf.train.string_input_producer读取

时间:2017-01-27 18:43:37

标签: tensorflow

我有一个包含约160万张图像的数据集。我已经将这些图像的完整路径存储在一个文本文件中(每行一个完整路径,因此有160万行)。 我已使用FIFOQueue函数将此列表存储在tf.train.string_input_producer中。我想从中读取一个文件的名称,然后在一个函数中读取它,然后在进行训练之前对它进行一些预处理。

我的代码文件中的一小段代码如下:

imgnames = []    
for line in open(imgfilelist, 'r'):
   imgnames.append(line.strip())
imgnames = tf.convert_to_tensor(imgnames)
input_queue = tf.train.string_input_producer(imgnames, num_epochs=50,\
                                             capacity=500)
# Not using TextLineReader() since I do not have a CSV file.
reader = tf.WholeFileReader()
key, value = reader.read(input_queue)     

这给出了如下关键字:

 <tf.Tensor 'ReaderRead_1:0' shape=() dtype=string>

和值如下:

  <tf.Tensor 'ReaderRead_1:1' shape=() dtype=string>

此时我感到迷茫。

  1. 为什么shape=()
  2. 如何获取可在函数内使用的实际文件名?

0 个答案:

没有答案