PIL Image.open display image reversely rotated
I'm working on predicting the number picture as  below with MNIST dataset and LeNet Model . Firstly, I show test images with Image.open, it displays test images in the way of reversely rotated.



from PIL import Image
import matplotlib.cm as cm
import pylab as pl
import numpy as np

img = Image.open('./test/2.png').convert('L')
img = np.invert(img) # convert to white on black
pl.imshow(np.asarray(img), origin='lower', cmap=cm.Greys_r)
pl.show()


Another issue is  the accuracy ratio of prediction seem very low. For example, the 2 here has been predicted as 4.

Someone could help with that or explain?  In my point of views, this number is much clear than handwriting MNIST. Thanks a lot.



imshow just sees an array of data. So specifying origin='lower' means you're telling imshow that the origin of your data is in the lower corner. However, image data has its origin in the upper corner so you can either remove origin= completely (the default is 'upper') or specify 'upper'.

pl.imshow(np.asarray(img), cmap=cm.Greys_r)


or

pl.imshow(np.asarray(img), origin='upper', cmap=cm.Greys_r)

