【发布时间】:2019-08-04 08:49:24
【问题描述】:
我正在使用取自 TensorFlow 文档here 的以下代码创建标签和图像的张量流数据集。
# Reads an image from a file, decodes it into a dense tensor, and resizes it
# to a fixed shape.
def _parse_function(filename, label):
image_string = tf.read_file(filename)
image_decoded = tf.image.decode_jpeg(image_string)
image_resized = tf.image.resize_images(image_decoded, [28, 28])
return image_resized, label
# A vector of filenames.
filenames = tf.constant(["/var/data/image1.jpg", "/var/data/image2.jpg", ...])
# `labels[i]` is the label for the image in `filenames[i].
labels = tf.constant([0, 37, ...])
dataset = tf.data.Dataset.from_tensor_slices((filenames, labels))
dataset = dataset.map(_parse_function)
我现在想验证图像是否已添加到数据集中并检查尺寸。我该怎么做呢?
【问题讨论】:
标签: python tensorflow image-segmentation tensorboard tensorflow-datasets