Invalid shape (28, 28, 1) for image data

Hello everyone,

I am getting invalid shape error when I ran this block of code,
can you please help me, what I did miss or any?

Thank you.

squeeze() the image.

imshow(), when plotting grayscale image doesn’t need the channel.

1 Like

It is working, Thank You.

But in lecture, Akash Sir has used permute method where it is working, so Why now it is showing error?

Perhaps he used RGB (color) images. Or grey images that pretend to be RGB (information copied over the channels).

1 Like

ya, It might be. Thank you.