如何可视化喀拉拉邦的预测类?

时间:2018-10-25 06:50:45

标签: python matplotlib

我想将我的cnn训练模型的预测结果可视化,但是我面临一个错误:无法将大小为3072的数组重塑为形状(28,28)。 代码如下:

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)

1 个答案:

答案 0 :(得分:0)

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