title: transfer learning TypeError: 'module' object is not callable
body: <p>I am having problems with my machine learning project. I made a CNN model and I want to test it out in a VGG16 VGG19 restnet models and other models this is the code that I think will make it work and i can just change vgg16 to other models. However, I keep getting this error:</p>
  
  <blockquote>
    <p>C:\Users\Acer\Anaconda3\envs\condas\pythonw.exe C:/Users/Acer/PycharmProjects/condas/rawr.py
    Using TensorFlow backend.
    Traceback (most recent call last):
      File "C:/Users/Acer/PycharmProjects/condas/rawr.py", line 9, in 
        my_new_model.add(vgg16.VGG16(include_top=False, pooling='avg', weights=resnet_weights_path))
      File "C:\Users\Acer\Anaconda3\envs\condas\lib\site-packages\keras_applications\vgg16.py", line 97, in VGG16
        data_format=backend.image_data_format(),
    AttributeError: 'NoneType' object has no attribute 'image_data_format'</p>
  </blockquote>
  
  <p>Process finished with exit code 1</p>
  
  <pre><code>from keras.applications.vgg16 import vgg16
  from keras.models import Sequential
  from keras.layers import Dense, Flatten, GlobalAveragePooling2D
  
  num_classes = 2
  resnet_weights_path = 'C:/Users/Acer/imagerec/EDA'
  
  my_new_model = Sequential()
  my_new_model.add(vgg16.VGG16(include_top=False, pooling='avg', weights=resnet_weights_path))
  my_new_model.add(Dense(num_classes, activation='softmax'))
  
  
  my_new_model.layers[0].trainable = False
  
  my_new_model.compile(optimizer='sgd', loss='categorical_crossentropy', metrics=['accuracy'])
  
  from keras.applications.vgg16 import preprocess_input
  from keras.preprocessing.image import ImageDataGenerator
  
  image_size = 224
  data_generator = ImageDataGenerator(preprocessing_function=preprocess_input)
  
  
  train_generator = data_generator.flow_from_directory(
          'C:/Users/Acer/imagerec/EDA',
          target_size=(image_size, image_size),
          batch_size=20,
          class_mode='categorical')
  
  validation_generator = data_generator.flow_from_directory(
          'C:/Users/Acer/imagerec/EDA',
          target_size=(image_size, image_size),
          class_mode='categorical')
  
  my_new_model.fit_generator(
          train_generator,
          steps_per_epoch=3,
          validation_data=validation_generator,
          validation_steps=1)
  </code></pre>