title: Tensorflow Image Shape Error
body: <p>I have trained a classifier and I now want to pass any single image through.</p>
  
  <p>I'm using the keras library with Tensorflow as the backend.</p>
  
  <p>I'm getting an error I can't seem to get past</p>
  
  <pre><code>img_path = '/path/to/my/image.jpg'
  
  import numpy as np
  from keras.preprocessing import image
  x = image.load_img(img_path, target_size=(250, 250))
  
  x = image.img_to_array(x)
  x = np.expand_dims(x, axis=0)
  
  preds = model.predict(x) 
  </code></pre>
  
  <p>Do I need to reshape my data to have <code>None</code> as the first dimension? I'm confused why Tensorflow would expect <code>None</code> as the first dimension?</p>
  
  <pre><code>Error when checking : expected convolution2d_input_1 to have shape (None, 250, 250, 3) but got array with shape (1, 3, 250, 250)
  </code></pre>
  
  <p>I'm wondering if there has been an issue with the architecture of my trained model?</p>
  
  <p>edit: if i call <code>model.summary()</code> give convolution2d_input_1 as...</p>
  
  <p><a href="https://i.stack.imgur.com/VvXZB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VvXZB.png" alt="enter image description here"></a></p>
  
  <p>Edit: I did play around with the suggestion below but used numpy to transpose instead of tf - still seem to be hitting the same issue!</p>
  
  <p><a href="https://i.stack.imgur.com/AArzY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AArzY.png" alt="enter image description here"></a></p>