title: Iterating over Conv2D layers of a pre-trained model
body: <p>I am using progressive learning for making a model for classification. I first used vgg16 weights and add a Dense layer at the end to train the model.</p>
  
  <pre><code>prior = keras.applications.VGG16(
      include_top=False, 
      weights='imagenet',
      input_shape=(48, 48, 3)
  )
  model = Sequential()
  model.add(prior)
  model.add(Flatten())
  model.add(Dense(256, activation='relu', name='Dense_Intermediate'))
  model.add(Dropout(0.1, name='Dropout_Regularization'))
  model.add(Dense(2, activation='sigmoid', name='Output'))
  
  for cnn_block_layer in model.layers[0].layers:
      cnn_block_layer.trainable = False
  model.layers[0].trainable = False
  </code></pre>
  
  <p>I froze the vgg layers so their weights do not change. After training, I saved the weights.</p>
  
  <pre><code>model.save('model65x65.h5')
  </code></pre>
  
  <p>I increased the dimension of the images using ImageDataGenerator and loaded previously saved model weights and I defined a new model</p>
  
  <pre><code>model = Sequential()
  model.add(Conv2D(64, kernel_size=(3, 3), input_shape=(96, 96, 3), activation='relu', padding='same'))
  model.add(Conv2D(64, kernel_size=(3, 3), input_shape=(96, 96, 3), activation='relu', padding='same'))
  model.add(MaxPooling2D(pool_size=(2, 2)))
  
  prior = load_model('./model65x65.h5')
  </code></pre>
  
  <p>Now I wanted to add all but the first two layers of VGG16 to the new model, strip the input layer out and also strip out the first convolutional layer using</p>
  
  <pre><code>for layer in prior.layers[0].layers[2:]:
      model.add(layer)
  
  # re-add the feedforward layers on top
  for layer in prior.layers[1:]:
      model.add(layer)
  
  # the pretrained CNN layers are already marked non-trainable
  # mark off the top layers as well
  for layer in prior.layers[-4:]:
      layer.trainable = False
  </code></pre>
  
  <p>As there are convolutional layers in the VGG16, I keep getting this error when I try to iterate over the prior model.</p>
  
  <p><strong>AttributeError: 'Conv2D' object has no attribute 'layers'</strong>
  How can I iterate over the Conv2D layers?</p>