Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tensorflow as tf
- import matplotlib.pyplot as plt
- import numpy as np
- import os
- %matplotlib inline
- path = './Test_Dataset_png'
- file_paths = [os.path.join(path, filename)
- for filename in os.listdir(path)]
- tf.reset_default_graph()
- filename_queue = tf.train.string_input_producer(file_paths)
- reader = tf.WholeFileReader()
- key, value = reader.read(filename_queue)
- decoded_img = tf.image.decode_png(value)
- decoded_img = tf.reduce_mean(decoded_img, axis=-1)
- with tf.Session() as sess:
- coord = tf.train.Coordinator()
- thread = tf.train.start_queue_runners(sess, coord)
- image = sess.run(decoded_img)
- print(image.shape)
- plt.imshow(image)
- coord.request_stop()
- coord.join(thread)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement