SHARE
TWEET

Untitled

a guest Jun 15th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. with tf.Session() as sess:
  2.     # Initialize image
  3.     sess.run(tf.global_variables_initializer())
  4.     sess.run(layers['input'].assign(generate_noise_image()))
  5.      
  6.     for epoch in range(epochs):
  7.       epoch_loss, epoch_content_loss, epoch_style_loss, _ = sess.run([J_total,J_content,J_style,optimizer])
  8.  
  9.       if (epoch+1) % 100 == 0:
  10.         generated_image = sess.run(layers['input'])
  11.         generated_image = save_image(generated_image,prefix + '_' + str(epoch+1) + '.jpg')
  12.         print('Loss after epoch %d: \nT: %f, \nC: %f, \nS: %f'%(epoch,epoch_loss,epoch_content_loss,epoch_style_loss))
  13.         generated_image = cv2.cvtColor(generated_image, cv2.COLOR_RGB2BGR)
  14.         cv2_imshow(generated_image)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top