title: Remove layers from a custom pre-trained model
body: <p>I did transfer learning on the Inception model from keras like this:</p>
  
  <pre><code>base_model = applications.InceptionV3(weights='imagenet', include_top=False, input_shape=input_shape)
  
  model_top = Sequential()
  model_top.add(GlobalAveragePooling2D(input_shape=base_model.output_shape[1:], data_format=None))
  model_top.add(Dropout(0.4))
  model_top.add(Dense(2))
  model_top.add(Activation("softmax"))
  
  # model_top.summary()
  
  model = Model(inputs=base_model.input, outputs=model_top(base_model.output))
  </code></pre>
  
  <p>I want to extract features from the GlobalAveragePooling layer using the trained model, but I don't know how to access it. 
  After loading the model the summary look like this:<a href="https://i.stack.imgur.com/vQqiq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vQqiq.png" alt="enter image description here"></a></p>
  
  <p>If a show the summary for <code>self.model.layers[-1]</code> I can see the GlobalAveragePooling, Dropout and the Dense layer that are in the Sequential, but not the Inception layers. What I want is the Inception layers, followed by just GlobalAveragePooling.</p>
  
  <p>Is this possible or I have to make the architecture again using the functional API and retrain the whole thing?</p>
  
  <p>Thank you!</p>