title: Is image needed to rescale before predicting with model that trained with ImageDataGenerator(1./255)?
body: <p>After training model with ImageDataGenerator(1/255.), do I need to rescale image before predicting ? 
  I thought it is necessary but experiment result said NO.</p>
  
  <p>I trained a Resnet50 model which has 37 class on top layer.
  Model was trained with ImageDataGenerator like this.</p>
  
  <pre class="lang-py prettyprint-override"><code>datagen = ImageDataGenerator(rescale=1./255)
  generator=datagen.flow_from_directory(
      directory=os.path.join(os.getcwd(), data_folder),
      target_size=(224,224),
      batch_size=256,
      classes=None,
      class_mode='categorical')
  
  history = model.fit_generator(generator, steps_per_epoch=generator.n / 256, epochs=10)
  </code></pre>
  
  <p>Accuracy achieved 98% after 10 epochs on my train dataset.
  The problem is, when i tried to predict each image in TRAIN dataset, prediction was wrong ( result is 33 whatever input image was ) </p>
  
  <pre class="lang-py prettyprint-override"><code>img_p = './data/pets/shiba_inu/shiba_inu_27.jpg'
  img = cv2.imread(img_p, cv2.IMREAD_COLOR)
  img = cv2.resize(img, (224,224))
  
  img_arr = np.zeros((1,224,224,3))
  img_arr[0, :, :, :] = img / 255.
  pred = model.predict(img_arr)
  yhat = np.argmax(pred, axis=1)
  </code></pre>
  
  <p>yhat is 5, but y is 33</p>
  
  <p>When I replace this line</p>
  
  <pre class="lang-py prettyprint-override"><code>img_arr[0, :, :, :] = img / 255.
  </code></pre>
  
  <p>by this</p>
  
  <pre class="lang-py prettyprint-override"><code>img_arr[0, :, :, :] = img
  </code></pre>
  
  <p>yhat is exactly 33.</p>
  
  <p>Someone might suggest to use predict_generator() instead of predict(), but I want to understand what I did wrong here.</p>