Skip to content

Instantly share code, notes, and snippets.

@ArnoutDevos
Created January 8, 2018 14:12
Show Gist options
  • Save ArnoutDevos/ca35f2f5ac8c860f3a171eba113fa9c5 to your computer and use it in GitHub Desktop.
Save ArnoutDevos/ca35f2f5ac8c860f3a171eba113fa9c5 to your computer and use it in GitHub Desktop.
# Number of iterations to run.
ITERATIONS = 500
sess.run(tf.global_variables_initializer())
input_image = np.reshape(gen_image, ((1,) + gen_image.shape))
sess.run(model['input'].assign(input_image))
for it in range(ITERATIONS):
sess.run(train_step)
if it%50 == 0:
# Print every 50 iteration.
mixed_image = sess.run(model['input'])
print('Iteration %d' % (it))
print('cost: ', sess.run(total_loss))
if not os.path.exists(OUTPUT_DIR):
os.mkdir(OUTPUT_DIR)
filename = 'output/%d.png' % (it)
save_image(filename, mixed_image[0])
final_image = recover_image(mixed_image[0]);
imshow(final_image)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment