以上链接为对于该问题的解释以及图片,同时出现该问题原因如下:
1.没有使用汉堡式建模
2.tensorflow在2.6以上
解决方法:
predict_x=model.predict(X_test)
classes_x=np.argmax(predict_x,axis=1)
错误的2种解决方法:
#1 sequential way only
#1 prediction = model.predict_classes(test_images) #结果预测 # old way
#2 prediction = model.predict(test_images) # not use
#2 prediction = np.int64(prediction>0.5)
解决结果如图:
欢迎补充总结。