title: AttributeError: 'ImageDataGenerator' object has no attribute 'shape'
body: <p>I am new in coding. I am trying to get the score but unfortunately i am getting errors. I was using first import.keras until it gave me when i wanted to evaluate the score and predict.The training model happened well, i have gotten no problem there.It is after that, when i was aboout to get the score of my model that i got as error ImageDataGnerator: Object has no 'ndim'.
  Then i looked for help and someone told me to use import.tensorflow.keras instead and i did it....</p>
  
  <p>After training the model again,reaching that part in order to get the score and predict after i've gotten another error saying : ImageDataGenerator  object has no attribute shapes and a warning saying : 
  <strong>WARNING</strong> <strong>:</strong> <strong>tensorflow</strong> <strong>:</strong> <strong>Falling</strong> <strong>back</strong> <strong>from</strong> <strong>v2</strong> <strong>loop</strong> <strong>because</strong> <strong>of</strong> <strong>error</strong> <strong>:</strong> <strong>Failed</strong> <strong>to</strong> <strong>find</strong> <strong>data* **adapter</strong> <strong>that</strong> <strong>can</strong> <strong>handle</strong> <strong>input</strong> <strong>:</strong>  <strong>&lt;</strong> <strong>class</strong> <strong>'tensorflow.python.keras.preprocessing.image.ImageDataGenerator'></strong> <strong>,</strong> <strong>&lt;</strong> <strong>class</strong> <strong>'NoneType'</strong></p>
  
  <p>This is some of the code below.</p>
  
  <pre><code>import numpy as np 
  import tensorflow as tf 
  import cv2
  import sys 
  import os
  import matplotlib.pyplot as plt
  from tensorflow import keras
  from tensorflow.keras.preprocessing.image import ImageDataGenerator
  from tensorflow.keras.models import Sequential
  from tensorflow.keras.layers import Dense, Dropout, Activation, Flatten
  from tensorflow.keras.layers import Conv2D, MaxPooling2D
  from tensorflow.keras.optimizers import Adam 
  
  
  image_width, image_height = 150,150
  
  Epochs =10
  batch_size=45
  Steps_per_epoch=190
  Validation_data=20
  num_classes = len(map_characters)
  
  
  
  
  model = Sequential()
  model.add(Conv2D(32, (3, 3), padding='same', input_shape= (image_height,image_width ,3)))
  model.add(Activation('relu'))
  model.add(Conv2D(32, (3, 3)))
  model.add(Activation('relu'))
  model.add(MaxPooling2D(pool_size=(2, 2)))
  model.add(Dropout(0.2))
  
  model.add(Conv2D(64, (3, 3), padding='same'))
  model.add(Activation('relu'))
  model.add(Conv2D(64, (3, 3)))
  model.add(Activation('relu'))
  model.add(MaxPooling2D(pool_size=(2, 2)))
  model.add(Dropout(0.2))
  
  model.add(Conv2D(256, (3, 3), padding='same')) 
  model.add(Activation('relu'))
  model.add(Conv2D(256, (3, 3)))
  model.add(Activation('relu'))
  model.add(MaxPooling2D(pool_size=(2, 2)))
  model.add(Dropout(0.2))
  
  model.add(Flatten())
  model.add(Dense(1024))
  model.add(Activation('relu'))
  model.add(Dropout(0.5))
  model.add(Dense(num_classes, activation='softmax'))
  opt = Adam(lr=0.01, decay=1e-6, )
  
  model.summary()
  
  model.compile(loss='categorical_crossentropy',
                optimizer='Adam',   
                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) 
  
  training_generator = train_datagen.flow_from_directory(
   train_data_dir, 
   target_size = (image_height, image_width),
   batch_size = batch_size, 
   class_mode = 'categorical')
  
  validation_generator = test_datagen.flow_from_directory(
   validation_data_dir, 
   target_size = (image_height, image_width), 
   batch_size = batch_size, 
   class_mode = 'categorical') 
  
  
  
  result=model.fit_generator(training_generator, 
                     steps_per_epoch=Steps_per_epoch,
                     epochs = Epochs, 
                     validation_data = validation_generator,
                     validation_steps=Validation_data) 
  
  score = model.evaluate(test_datagen,
                    validation_generator,
                    batch_size=batch_size)
  </code></pre>