title: Google Colab taking too much time to train a classifier. How to fix this?
body: <p>I want to train a classifier in google colab using Keras to classify if the image represents a dog or a cat. There are 8000 training samples and 2000 testing samples. The time taken for 1 epoch is 12hrs. I am new to google colab and i don't know how to fix this. I am using GPU as the hardware acceleration and i thought that having 1xTesla K80 would take less than 5 min but it is taking too much time.</p>
  
  <p>I have tried changing the runtime to GPU as well as TPU but both the runtimes are not working.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>classifier = Sequential()
  
  classifier.add(Conv2D(32, (3, 3), input_shape = (64, 64, 3), activation = 
   'relu'))
  
  classifier.add(MaxPooling2D(pool_size = (2, 2)))
  
  classifier.add(Conv2D(32, (3, 3), activation = 'relu'))
  classifier.add(MaxPooling2D(pool_size = (2, 2)))
  
  classifier.add(Flatten())
  
  classifier.add(Dense(units = 128, activation = 'relu'))
  classifier.add(Dense(units = 1, activation = 'sigmoid'))
  
  classifier.compile(optimizer = 'adam', loss = 'binary_crossentropy', 
  metrics = ['accuracy'])
  
  from keras.preprocessing.image import ImageDataGenerator
  
  train_datagen = ImageDataGenerator(rescale = 1./255,
                                 shear_range = 0.2,
                                 zoom_range = 0.2,
                                 horizontal_flip = True)
  
  test_datagen = ImageDataGenerator(rescale = 1./255)
  
  training_set = train_datagen.flow_from_directory('/content/gdrive/My 
  Drive/Colab Notebooks/dataset/training_set',
  target_size = (64, 64),
  batch_size = 32,
  class_mode = 'binary')
  
  test_set = test_datagen.flow_from_directory('/content/gdrive/My 
  Drive/Colab Notebooks/dataset/test_set',
   target_size = (64, 64),                                          
  batch_size = 32,
  class_mode = 'binary')
  
  classifier.fit_generator(training_set,
                       steps_per_epoch = 8000,
                       epochs = 1,
                       validation_data = test_set,
                       validation_steps = 2000)
  </code></pre>
  
  <p>There are many deprecations while executing this code. After executing classifier.fit_generator() , it shows 12 hrs remaining for 1 epoch</p>