python running error:
Error content: 'Sequential' object has no attribute 'predict_classes'
reason:
There is a predict_class attribute in the version before Tensorflow2.6, and the later version has been cancelled.
Solution
Replace the code (you can modify the parameters according to the code yourself). as follows:
(1) Original code
model = load_model('020_mnist_model.h5')
result = model.predict_classes(x_test[0].reshape(1,784))
result
(2) Modified code
result = model.predict(x_test[0].reshape(1,784))
result = np.argmax(result, axis=1)
result
test
The result can be output normally, complete.