title: keras load model error trying to load a weight file containing 17 layers into a model with 0 layers
body: <p>I am currently working on vgg16 model with keras.
  I fine tune vgg model with some of my layer.
  After fitting my model (training), I save my model with <code>model.save('name.h5')</code>.
  It can be saved without problem. 
  However, when I try to reload the model with <code>load_model</code> function, it shows the error:</p>
  
  <blockquote>
    <p>You are trying to load a weight file containing 17 layers into a model
    with 0 layers</p>
  </blockquote>
  
  <p>Did anyone meet this problem before?
  My keras verion is 2.2.</p>
  
  <p>Here is part of my code ...</p>
  
  <pre><code>from keras.models import load_model
  vgg_model = VGG16(weights='imagenet',include_top=False,input_shape=(224,224,3))    
  global model_2
  model_2 = Sequential()
  for layer in vgg_model.layers:
      model_2.add(layer)
  for layer in model_2.layers:
      layer.trainable= False
  model_2.add(Flatten())
  model_2.add(Dense(128, activation='relu'))
  model_2.add(Dropout(0.5))
  model_2.add(Dense(2, activation='softmax'))
  model_2.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
  model_2.fit(x=X_train,y=y_train,batch_size=32,epochs=30,verbose=2)
  model_2.save('name.h5')
  del model_2
  model_2 = load_model('name.h5')
  </code></pre>
  
  <p>Actually I do not delete the model and then <code>load_model</code> immediately, 
  just for showing my problem.</p>