Hey Amrita,

Thank you for reading my tutorial. Happy to help.

Look at the code where I reshaped the test dataset to 4-dims with the following code:

x_test = x_test.reshape(x_test.shape[0], 28, 28, 1)

Therefore, you need to reshape your dataset/image before calling the model.predict, with Numpy’s Reshape function.

Then, after making the prediction, you need to reduce it two 2-dims again to visualize it with something similar to the following code:

plt.imshow(x_test[image_index].reshape(28, 28),cmap=’Greys’)

Hope this helps.

Written by

I write about artificial intelligence and machine learning. Join hundreds of others to speed up your machine learning journey → eepurl.com/hd6Xfv

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store