why is this error coming?
If we can plot (120,140,3) shape image then why
not (28,28,1)shape image.
After reshaping image is correctly shown how?
CNN 08 - Building Fashion MNIST CNN in Keras
You cannot plot 28,28,1 using matplotlib’s imshow. This is because if your pass 3 dimension numpy array than matplotlib’s imshow function expects 3rd value in numpy’array’s shape to be 3, corresponding to 3 channels, RGB and not 1. But on other hand if you pass 2D numpy array than it can be plotted easily, means matlplotlib’s imshow function understands that it is recieving a gray scale image. It than assigns color map accordingly and you see a colored image which is actully grayscale.
You can plot original gray scale image by using cmap = ‘gray’ in imshow function.
Hope this helped you
got it…
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.