【发布时间】:2015-11-26 17:58:43
【问题描述】:
我正在调整cifar10 convolution example 来解决我的问题。我想将数据输入从从文件中一次读取一个图像的设计更改为对内存中的一组图像进行操作的设计。原来的inputs() 函数是这样的:
read_input = cifar10_input.read_cifar10(filename_queue)
reshaped_image = tf.cast(read_input.uint8image, tf.float32)
# Crop the central [height, width] of the image.
resized_image = tf.image.resize_image_with_crop_or_pad(reshaped_image,
width, height)
在原始版本中,read_input 是一个包含一个图像的张量。
我将所有图像都保存在 RAM 中,因此我没有使用 filename_queue,而是使用了一个巨大的 images_tensor = tf.constant(images),其中 images_tensor.shape 是(32、32、3)。
我的问题非常非常基本:将某些功能(在我的情况下为tf.image.resize_image_with_crop_or_pad)应用于images_tensor 的所有元素的最佳方法是什么?
在 tensorflow 中迭代是有问题的,切片有限 (TensorFlow - numpy-like tensor indexing)。是否有解决方案可以仅使用一个命令来实现这一目标?
【问题讨论】:
标签: python functional-programming tensorflow