简体   繁体   中英

how to visualize prediction classes in keras?

I want to visualize prediction results from my cnn trained model.But I am facing a error : cannot reshape array of size 3072 into shape (28,28). The code is given below:

L = 5
W = 5
fig, axes = plt.subplots(L, W, figsize = (12,12))
axes = axes.ravel() # 

for i in np.arange(0, L * W):  
    axes[i].imshow(x_test[i].reshape(28,28))
    axes[i].set_title("Prediction Class = {:0.1f}\n True Class 
    {:0.1f}".format(predicted_classes[i], y_test[i]))
    axes[i].axis('off')

plt.subplots_adjust(wspace=0.5)

28 * 28!=3072。我假设每个图像尺寸为(32,32,3)(32 * 32 * 3 == 3072)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM