Last active
August 24, 2017 01:30
-
-
Save leechanwoo/7d82f7db5198908561cedd30082e80ec to your computer and use it in GitHub Desktop.
queue runners
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
import matplotlib.pyplot as plt | |
import os | |
%matplotlib inline | |
files = "dataset/test_dataset_png/" | |
file_dir = os.path.join(os.getcwd(), files) | |
filenames = [os.path.join(file_dir, f) for f in os.listdir(file_dir)] | |
filename_queue = tf.train.string_input_producer(filenames) | |
reader = tf.WholeFileReader() | |
key, value = reader.read(filename_queue) | |
decoded_img = tf.image.decode_png(value) | |
decoded_img = tf.reduce_mean(decoded_img, axis=2) | |
with tf.Session() as sess: | |
coord = tf.train.Coordinator() | |
thread = tf.train.start_queue_runners(sess, coord) | |
image = sess.run(decoded_img) | |
plt.imshow(image) | |
coord.request_stop() | |
coord.join(thread) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment