title: Error in python: 'list' object has no attribute 'shape'
body: <p>I am implementing transfer learning(vgg16) in python. My images are 512<em>512. As Vgg16 takes an input image of size 224</em>224, I am trying to divide each of my training images into several small patches. I would run my model into these small patches and would combine the individual results to get a final result for each of my training images. Please find my code below:</p>
  <pre><code>import cv2
  import numpy as np
  from tensorflow.keras.utils import normalize
  from matplotlib import pyplot as plt
  patch_size=224
  def prediction(model1, image, patch_size):
      segm_img = (np.zeros(image.shape[:2]))  
      patch_num=1
      for i in range(0, image.shape[0], 224):   #Steps of 224
          for j in range(0, image.shape[1], 224):  #Steps of 224
              #print(i, j)
               single_patch = image[i:i+patch_size, j:j+patch_size]
               single_patch_norm = np.expand_dims(normalize(np.array(single_patch),axis=1),2)
               single_patch_shape = single_patch_norm.shape[:2]
               single_patch_input = np.expand_dims(single_patch_norm, 0)
               single_patch_prediction = (model.predict(single_patch_input)[0,:,:,0] &gt; 
               0.5).astype(np.uint8)
               segm_img[i:i+single_patch_shape[0], j:j+single_patch_shape[1]] += 
                        cv2.resize(single_patch_prediction, single_patch_shape[::-1])
               print(&quot;Finished processing patch number &quot;, patch_num, &quot; at position &quot;, i,j)
               patch_num+=1
  return segm_img
  from tensorflow.keras.preprocessing.image import ImageDataGenerator
  train_datagen = ImageDataGenerator(rescale = 1./255,
                                     shear_range = 0.2,
                                     zoom_range = 0.2,
                                     validation_split=0.10,
                                     horizontal_flip = True)
   test_datagen = ImageDataGenerator(rescale = 1./255)
   import glob
   import cv2  
   training_set = [cv2.imread(file) for file in 
                   glob.glob(&quot;D:/regionGrowing_MLT/AllNewOriginalImage/Training/*.png&quot;)]
   new_training_set = prediction(model, training_set, patch_size)
  </code></pre>
  <p>I am getting the following error message:</p>
  <pre><code>AttributeError                            Traceback (most recent call last)
  &lt;ipython-input-113-7f5dc4c94b8c&gt; in &lt;module&gt;
  ----&gt; 1 new_training_set = prediction(model, training_set, patch_size)
  
  &lt;ipython-input-110-71e724069bfc&gt; in prediction(model1, image, patch_size)
        1 def prediction(model1, image, patch_size):
  ----&gt; 2     segm_img = (np.zeros(image.shape[:2]))  #Array with zeros to be filled with segmented values
        3     segm_img=np.array(segm_img)
        4     patch_num=1
        5     for i in range(0, image.shape[0], 224):   #Steps of 224
  AttributeError: 'list' object has no attribute 'shape'
  </code></pre>
  <p>Any suggestions would be appreciated</p>