title: Keras fit freezes at the end of the first epoch
body: <p>I am currently experimenting with fine tuning the VGG16 network using Keras.</p>
  
  <p>I started tweaking a little bit with the cats and dogs dataset.</p>
  
  <p>However, with the current configuration the training seems to block on the first epoch </p>
  
  
  
  <pre class="lang-python prettyprint-override"><code>from keras import applications
  from keras.preprocessing.image import ImageDataGenerator
  from keras import optimizers
  from keras.models import Sequential, Model
  from keras.layers import Dropout, Flatten, Dense
  
  
  img_width, img_height = 224, 224
  
  train_data_dir = 'data/train'
  validation_data_dir = 'data/validation'
  nb_train_samples = 2000
  nb_validation_samples = 800
  epochs = 50
  batch_size = 20
  
  
  model = applications.VGG16(weights='imagenet', include_top=False , input_shape=(224,224,3))
  print('Model loaded.')
  
  
  top_model = Sequential()
  top_model.add(Flatten(input_shape=model.output_shape[1:]))
  top_model.add(Dense(256, activation='relu',name='newlayer'))
  top_model.add(Dropout(0.5))
  top_model.add(Dense(2, activation='softmax'))
  
  
  model = Model(inputs= model.input, outputs= top_model(model.output))
  
  
  for layer in model.layers[:19]:
      layer.trainable = False
  
  
  model.compile(loss='categorical_crossentropy',
                optimizer=optimizers.Adam(lr=0.0001),
                metrics=['accuracy'])
  
  train_datagen = ImageDataGenerator(
      rescale=1. / 255,
      shear_range=0.2,
      zoom_range=0.2,
      horizontal_flip=True)
  
  test_datagen = ImageDataGenerator(rescale=1. / 255)
  
  train_generator = train_datagen.flow_from_directory(
      train_data_dir,
      target_size=(img_height, img_width),
      batch_size=batch_size,
      shuffle=True,
      class_mode='categorical')
  
  validation_generator = test_datagen.flow_from_directory(
      validation_data_dir,
      target_size=(img_height, img_width),
      batch_size=batch_size,
      class_mode='categorical')
  
  
  model.fit_generator(
      train_generator,
      steps_per_epoch=nb_train_samples// batch_size,
      epochs=epochs,
      validation_data=validation_generator,
      validation_steps=nb_validation_samples)
  </code></pre>
  
  <p>Last output:</p>
  
  <blockquote>
    <p>Epoch 1/50  99/100 [============================>.] - ETA: 0s - loss:
    0.5174 - acc: 0.7581</p>
  </blockquote>
  
  <p>Am I missing something ?</p>