title: How to correctly use an intermediate layer of a vgg model
body: <p>What I did is:</p>
  
  <pre><code>from keras.applications.vgg16 import VGG16
  from keras.layers import *
  from keras.models import Model
  import numpy as np 
  
  vgg_model = VGG16(weights='imagenet', include_top=False, input_shape = (224,224, 3)) 
  
  block5_conv3 = vgg_model.get_layer("block5_conv3").output
  
  input_image = Input(shape=(224,224, 3), name='image_input')
  vgg_out = vgg_model(input_image)
  
  f0 = Flatten()(block5_conv3)
  
  test_model = Model(inputs=input_image, outputs=f0)
  print(test_model.summary())
  </code></pre>
  
  <p>But I got the following error message:</p>
  
  <pre><code>Traceback (most recent call last):
    File "test.py", line 15, in &lt;module&gt;
      test_model = Model(inputs=input_image, outputs=f0)
    File "C:\Users\wzhou\AppData\Local\Continuum\Anaconda2\envs\tensorflow\lib\site-packages\keras\legacy\interfaces.py", line 91, in wrapper
      return func(*args, **kwargs)
    File "C:\Users\wzhou\AppData\Local\Continuum\Anaconda2\envs\tensorflow\lib\site-packages\keras\engine\network.py", line 93, in __init__
      self._init_graph_network(*args, **kwargs)
    File "C:\Users\wzhou\AppData\Local\Continuum\Anaconda2\envs\tensorflow\lib\site-packages\keras\engine\network.py", line 237, in _init_graph_network
      self.inputs, self.outputs)
    File "C:\Users\wzhou\AppData\Local\Continuum\Anaconda2\envs\tensorflow\lib\site-packages\keras\engine\network.py", line 1430, in _map_graph_network
      str(layers_with_complete_input))
  ValueError: Graph disconnected: cannot obtain value for tensor Tensor("input_1:0", shape=(?, 224, 224, 3), dtype=float32) at layer "input_1". The following previous layers were accessed without issue: []
  </code></pre>
  
  <p>I feel something is wrong with the way that I did it but couldn't figure out the right way.</p>