title: Removing layers from a pretrained keras model gives the same output as original model
body: <p>During some feature extraction experiments, I noticed that the 'model.pop()' functionality is not working as expected. For a pretrained model like vgg16, after using 'model.pop()' , model.summary() shows that the layer has been removed (expected 4096 features), however on passing an image through the new model, it results in the same number of features (1000) as the original model. No matter how many layers are removed including a completely empty model, it generates the same output. Looking for your guidance on what might be the issue.</p>
  
  <pre><code>#Passing an image through the full vgg16 model
  model = VGG16(weights = 'imagenet', include_top = True, input_shape = (224,224,3))
  img = image.load_img( 'cat.jpg', target_size=(224,224) )
  img = image.img_to_array( img )
  img = np.expand_dims( img, axis=0 )
  img = preprocess_input( img )
  features = model.predict( img )
  features = features.flatten()
  print(len(features)) #Expected 1000 features corresponding to 1000 imagenet classes
  </code></pre>
  
  <p>1000</p>
  
  <pre><code>model.layers.pop()
  img = image.load_img( 'cat.jpg', target_size=(224,224) )
  img = image.img_to_array( img )
  img = np.expand_dims( img, axis=0 )
  img = preprocess_input( img )
  features2 = model.predict( img )
  features2 = features2.flatten()
  print(len(features2)) #Expected 4096 features, but still getting 1000. Why?
  #No matter how many layers are removed, the output is still 1000
  </code></pre>
  
  <p><strong>1000</strong></p>
  
  <p>Thank you!</p>
  
  <p>See full code here: <a href="https://github.com/keras-team/keras/files/1592641/bug-feature-extraction.pdf" rel="noreferrer">https://github.com/keras-team/keras/files/1592641/bug-feature-extraction.pdf</a></p>