我想将我的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)
答案 0 :(得分:0)
28 * 28!= 3072。 我假设每个图像尺寸为(32,32,3)(32 * 32 * 3 == 3072)