-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestData.py
More file actions
23 lines (18 loc) · 754 Bytes
/
Copy pathTestData.py
File metadata and controls
23 lines (18 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib.pyplot as plt
# Set i to test entry in dataset
testEntry = 9
data = keras.datasets.fashion_mnist
(train_images, train_labels), (test_images, test_labels) = data.load_data()
class_names = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat', 'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle boot']
train_images = train_images/255.0
test_images = test_images/255.0
model = keras.models.load_model("model.h5")
prediction = model.predict(test_images)
plt.grid(False)
plt.imshow(test_images[testEntry], cmap=plt.cm.binary)
plt.xlabel("Actual: " + class_names[test_labels[testEntry]])
plt.title("Prediction " + class_names[np.argmax(prediction[testEntry])])
plt.show()