Guest User

Untitled

a guest
Nov 12th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. saver = tf.train.Saver()
  2.  
  3. init = tf.global_variables_initializer()
  4. sess = tf.Session()
  5. sess.run(init)
  6.  
  7. saver.restore(sess, 'K:/autoencoder_color_to_gray/SavedModel/AutoencoderColorToGray.ckpt-49')
  8.  
  9. # For reading the file contents.
  10. import glob as gl
  11.  
  12. filenames = gl.glob('flower_images/*.png')
  13.  
  14. test_data = []
  15. for file in filenames[0:100]:
  16. test_data.append(np.array(cv2.imread(file)))
  17.  
  18. test_dataset = np.asarray(test_data)
  19. print(test_dataset.shape)
  20.  
  21. # Running the test data on the autoencoder
  22. batch_imgs = test_dataset
  23. gray_imgs = sess.run(ae_outputs, feed_dict = {ae_inputs: batch_imgs})
  24.  
  25. for i in range(gray_imgs.shape[0]):
  26. cv2.imwrite('gen_gray_images/gen_gray_' +str(i) +'.jpeg', gray_imgs[i])
Add Comment
Please, Sign In to add comment