title: Get Each Layer Output in Keras Model for a Single Image
body: <p>I would like to know how to get the output of each layer of a pre-trained CNN Keras model. What I am working on is to get the intermediate outputs of each layer in the model associated with a specific image I am providing to the model. Here is what I did:</p>
  <pre><code>model = load_model('model.h5')
  img = Image.open('img.jpg')
  img_array = np.array (img)
  img_array = img_array/255
  img_array = img_array.reshape(-1,512,512,1)
  pred = model.predict(img_array)
  </code></pre>
  <p>I am just so confused about what to do next to print the output of each layer in such a case!</p>