title: Keras use part of pretrained models (ResNet 18)
body: <p>I'm using pretraind ResNet18 from <a href="https://github.com/qubvel/classification_models" rel="nofollow noreferrer">here</a>
  I want to use part of the model from layer [4] to [-4]</p>
  <p>I tried to create a new model using wanted layers like</p>
  <pre><code>res_net = ResNet18((224, 224, 3), weights='imagenet')
  
  model = Model(res_net.layers[4].input, res_net.layers[-4].output)
  </code></pre>
  <p>but this error show</p>
  <blockquote>
  <p>ValueError: Graph disconnected: cannot obtain value for tensor
  Tensor(&quot;data_5:0&quot;, shape=(None, 224, 224, 3), dtype=float32) at layer
  &quot;bn_data&quot;. The following previous layers were accessed without issue:
  []</p>
  </blockquote>
  <p>also try this</p>
  <pre><code>res_net = ResNet18((224, 224, 3), weights='imagenet', include_top=False)
  
  x = Input(shape=(192, 640, 6))
  
  conv1 = layers.Conv2D(64, kernel_size=7, strides=2, padding='same', input_shape=(192, 640, 6),name='conv1')(x)
  
  l = res_net.layers[4](conv1) 
  for i in range(5, len(res_net.layers[:-4])):
      l = res_net.layers[i](l)
  
  model = Model(inputs=x,outputs=l)
  model.summary()
  </code></pre>
  <p>but this error show</p>
  <blockquote>
  <p>ValueError: A merge layer should be called on a list of inputs.</p>
  </blockquote>