【发布时间】:2016-04-07 23:00:16
【问题描述】:
我在 TensorFlow getting started guide for CNN 浏览 CIFAR-10 示例
现在在 cifar10_train.py 的 train 函数中,我们得到的图像是
images,labels = cifar10.distorted_inputs()
在distorted_inputs() 函数中,我们在队列中生成文件名,然后读取单个记录
# Create a queue that produces the filenames to read.
filename_queue = tf.train.string_input_producer(filenames)
# Read examples from files in the filename queue.
read_input = cifar10_input.read_cifar10(filename_queue)
reshaped_image = tf.cast(read_input.uint8image, tf.float32)
当我添加调试代码时,read_input 变量仅包含 1 条记录,其中包含图像及其高度、宽度和标签名称。
该示例然后对读取的图像/记录应用一些失真,然后将其传递给_generate_image_and_label_batch() 函数。
然后,此函数返回一个形状为 [batch_size, 32, 32, 3] 的 4D 张量,其中 batch_size = 128。
上述函数在返回批处理时使用tf.train.shuffle_batch() 函数。
我的问题是tf.train.shuffle_batch() 函数中的额外记录来自哪里?我们没有向它传递任何文件名或阅读器对象。
有人能解释一下我们是如何从 1 条记录变成 128 条记录的吗?我查看了文档但不明白。
【问题讨论】:
-
我也有同样的问题,很高兴我找到了这个
标签: machine-learning neural-network tensorflow