title: How to Solve: 'str' object has no attribute 'data_format' in keras
body: <p>I am trying to make a classifier which can classify cats and dogs using keras.
  I am just trying to create the tensor data from images using <strong>ImageDataGenerator.flow_from_directory()</strong> which are sorted and kept in the directories whose paths are given in train_path, test_path etc.</p>
  
  <p><strong>Here is my code:</strong> </p>
  
  <pre><code>import numpy as np
  
  import keras
  
  from keras import backend as K
  
  from keras.models import Sequential
  
  from keras.layers import Activation
  
  
  
  train_path = 'cats-and-dogs/train' test_path = 'cats-and-dogs/test' valid_path = 'cats-and-dogs/valid'
  
  train_dir = 'cats-and-dogs/' test_dir = 'cats-and-dogs/' valid_dir = 'cats-and-dogs/'
  
  
  
  train_batches = ImageDataGenerator.flow_from_directory(train_path, directory=train_dir, target_size=(200,200), classes=['dog','cat'], batch_size=10)
  
  test_batches = ImageDataGenerator.flow_from_directory(test_path, directory=test_dir, target_size=(200,200), classes=['dog','cat'], batch_size=5)
  
  valid_batches = ImageDataGenerator.flow_from_directory(valid_path, directory=valid_dir, target_size=(200,200), classes=['dog','cat'], batch_size=10)
  </code></pre>
  
  <p><strong>But I am getting the following error using python 3.5:</strong></p>
  
  <blockquote>
    <p>/usr/local/lib/python3.5/site-packages/h5py/<strong>init</strong>.py:36:
    FutureWarning: Conversion of the second argument of issubdtype from
    <code>float</code> to <code>np.floating</code> is deprecated. In future, it will be treated
    as <code>np.float64 == np.dtype(float).type</code>.   from ._conv import
    register_converters as _register_converters Using TensorFlow backend.
    Traceback (most recent call last):   File "CNNFromScratch.py", line
    29, in 
        train_batches = ImageDataGenerator.flow_from_directory(train_path, directory=train_dir, target_size=(200,200), classes=['dog','cat'],
    batch_size=10)   File
    "/usr/local/lib/python3.5/site-packages/keras/preprocessing/image.py",
    line 565, in flow_from_directory
        data_format=self.data_format,</p>
    
    <p>AttributeError: 'str' object has no attribute 'data_format'</p>
  </blockquote>
  
  <p><strong>What can I do to solve this problem?</strong> </p>