forked from golbin/TensorFlow-MNIST
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
26 lines (20 loc) · 698 Bytes
/
test.py
File metadata and controls
26 lines (20 loc) · 698 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import os
from MNISTTester import MNISTTester
####################
# directory settings
script_dir = os.path.dirname(os.path.abspath(__file__))
data_path = script_dir + '/mnist/data/'
model_path = script_dir + '/models/mnist-cnn'
#####################################
# prediction test with MNIST test set
mnist = MNISTTester(
model_path=model_path,
data_path=data_path)
mnist.accuracy_of_testset()
mnist.predict_random()
#################################
# prediction test with image file
# mnist = MNISTTester(model_path)
mnist.predict(script_dir + '/imgs/digit-4.png')
mnist.predict(script_dir + '/imgs/digit-2.png')
mnist.predict(script_dir + '/imgs/digit-5.png')