import tensorflow
import numpy as np
from tensorflow.keras.datasets import mnist
from tensorflow.keras.models import load_model
from tensorflow.keras.layers import Dropout, Flatten
import matplotlib.pyplot as plt
(trainX, trainY), (testX, testY) = mnist.load_data()
plt.imshow(testX[8])
plt.show()
img_rows, img_cols = 28, 28
testImg = testX[8].reshape(1,img_rows,img_cols,1)
testImg = testImg.astype("float32")
testImg /=255
model = load_model("mnist.h5")
pred = model.predict(testImg)
# print(pred.round())
print(np.argmax(pred.round()))
Comments