Wednesday, June 2, 2021

Pix2Pix IV - Visualizing the results of trained model

import matplotlib.pyplot as plt 
def generate_images(generator , input_image , target_image) : 
  generator_output = generator(input_image , training = True)

  plt.figure(figsize =(16,16))
  titles = ["Input Image" , "Target Image" , "Generated Image"]
  images = [input_image[0], target_image[0], generator_output[0]]
  for i  in range(3) : 
    plt.subplot( 1,3, i+ 1)
    plt.imshow(images[i] *0.5 + 0.5)
    plt.title("{} {}".format(titles[i], images[i].shape))
  plt.show()

checkpoint.restore(tf.train.latest_checkpoint("/content/checkpoint"))

for inp, tar in test_ds.take(5):
  generate_images(generator, inp, tar)

No comments:

Post a Comment

 using Microsoft.AspNetCore.Mvc; using System.Xml.Linq; using System.Xml.XPath; //<table class="common-table medium js-table js-stre...