title: ValueError: Input 0 of layer sequential is incompatible with the layer: : expected min_ndim=4, found ndim=2
body: <p>I'm working in a project that detects plant disease with leaf images using PlantVillage dataset.</p>
  <p>When I'm trying to predict the results using</p>
  <pre><code>image_dir=&quot;C:/Users/HP/Plant Disease Detection Using Deep Learning Approach/input/Potato___Early_blight/&quot;
  
  im=convert_image_to_array(image_dir)
  np_image_li = np.array(im, dtype=np.float16) / 225.0
  npp_image = np.expand_dims(np_image_li, axis=0)
  result=model.predict(npp_image)
  </code></pre>
  <p>I' getting an error</p>
  <p>ValueError: Input 0 of layer sequential is incompatible with the layer: : expected min_ndim=4, found ndim=2. Full shape received: (None, 0)</p>
  <p>I have built the model using</p>
  <pre><code>aug = ImageDataGenerator(
      rotation_range=25, width_shift_range=0.1,
      height_shift_range=0.1, shear_range=0.2, 
      zoom_range=0.2,horizontal_flip=True, 
      fill_mode=&quot;nearest&quot;)
  
  model = Sequential()
  inputShape = (height, width, depth)
  chanDim = -1
  if K.image_data_format() == &quot;channels_first&quot;:
      inputShape = (depth, height, width)
      chanDim = 1
  model.add(Conv2D(32, (3, 3), padding=&quot;same&quot;,input_shape=inputShape))
  model.add(Activation(&quot;relu&quot;))
  model.add(BatchNormalization(axis=chanDim))
  model.add(MaxPooling2D(pool_size=(3, 3)))
  model.add(Dropout(0.25))
  model.add(Conv2D(64, (3, 3), padding=&quot;same&quot;))
  model.add(Activation(&quot;relu&quot;))
  model.add(BatchNormalization(axis=chanDim))
  model.add(Conv2D(64, (3, 3), padding=&quot;same&quot;))
  model.add(Activation(&quot;relu&quot;))
  model.add(BatchNormalization(axis=chanDim))
  model.add(MaxPooling2D(pool_size=(2, 2)))
  model.add(Dropout(0.25))
  model.add(Conv2D(128, (3, 3), padding=&quot;same&quot;))
  model.add(Activation(&quot;relu&quot;))
  model.add(BatchNormalization(axis=chanDim))
  model.add(Conv2D(128, (3, 3), padding=&quot;same&quot;))
  model.add(Activation(&quot;relu&quot;))
  model.add(BatchNormalization(axis=chanDim))
  model.add(MaxPooling2D(pool_size=(2, 2)))
  model.add(Dropout(0.25))
  model.add(Flatten())
  model.add(Dense(1024))
  model.add(Activation(&quot;relu&quot;))
  model.add(BatchNormalization())
  model.add(Dropout(0.5))
  model.add(Dense(n_classes))
  model.add(Activation(&quot;softmax&quot;))
  </code></pre>