def read_and_decode(filename_queue):
reader = tf.TFRecordReader()
_, serialized_example = reader.read(filename_queue)
features = tf.parse_single_example(
serialized_example,
features={
'image_raw': tf.FixedLenFeature([], tf.string),
})
image = tf.decode_raw(features['image_raw'], tf.uint8)
image.set_shape(128 * 128 * 3)
image = tf.reshape(image, [128, 128, 3])
image = tf.cast(image, tf.float32) * (2. / 255) - 1.
return image
评论列表
文章目录