【发布时间】:2017-03-19 16:28:22
【问题描述】:
我有一个.tfrecords 文件,其中填充了标记数据。我想将其中的 X% 用于培训,将 (1-X)% 用于评估/测试。显然不应该有任何重叠。这样做的最佳方法是什么?
下面是我阅读tfrecords的一小段代码。有什么方法可以让shuffle_batch 将数据拆分为训练和评估数据?我是不是搞错了?
reader = tf.TFRecordReader()
files = tf.train.string_input_producer([TFRECORDS_FILE], num_epochs=num_epochs)
read_name, serialized_examples = reader.read(files)
features = tf.parse_single_example(
serialized = serialized_examples,
features={
'image': tf.FixedLenFeature([], tf.string),
'value': tf.FixedLenFeature([], tf.string),
})
image = tf.decode_raw(features['image'], tf.uint8)
value = tf.decode_raw(features['value'], tf.uint8)
image, value = tf.train.shuffle_batch([image, value],
enqueue_many = False,
batch_size = 4,
capacity = 30,
num_threads = 3,
min_after_dequeue = 10)
【问题讨论】:
标签: machine-learning tensorflow training-data