Predicting the restored image

I was following this guide (Low light image enhancement) on the Keras code examples. But rather than using it for the low light image enhancement, I used it on an Image restoration problem instead.

I’m learning how to implement a research paper by following guides on Keras’s examples. But when I tried to predict the image that is to get the restored image, my image seems like a white one with a few key points on it. I can’t see the structure or even the formation of any fingerprint on the predicted image.

Screenshot 2022-05-17 at 5.21.46 AM

I used the inference code on the same guide but getting a weird image output.

# Visualizing the inference images 

def plot_results(images , titles , figure_size = (12 ,12)):

  fig = plt.figure(figsize = (figure_size))
  for i in range(len(images)):
    fig.add_subplot(1 , len(images) , i + 1).set_title(titles[i])
    _ = plt.imshow(images[i])

# Get the prediction 

from PIL import Image , ImageOps

def infer_image(original_image):
  image = tf.keras.preprocessing.image.img_to_array(original_image)
  image = tf.image.resize(image , size = [124 , 124])
  #image = image.astype('float32') / 255.0
  image = tf.expand_dims(image , axis = 0)
  output = model.predict(image)

  output_image = output[0] * 255.0
  output_image = output_image.clip(0 , 255)
  output_image = output_image.reshape(
      (np.shape(output_image)[0] , np.shape(output_image)[1] , 3)

  output_image = Image.fromarray(np.uint8(output_image))
  original_image = Image.fromarray(np.uint8(original_image))

  return output_image

I’m not sure where I’m going wrong and the model which I built for this is doing better for fewer epochs and images in the training set.

Kindly help me in figuring out how to get the right restored predicted image for any given image.