35 lines
929 B
Plaintext
35 lines
929 B
Plaintext
#!c:\users\kratu\pycharmprojects\projekt_ai-automatyczny_saper\venv\scripts\python.exe
|
|
|
|
import random
|
|
import argparse
|
|
from mnist import MNIST
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("--id", default=None, type=int,
|
|
help="ID (position) of the letter to show")
|
|
parser.add_argument("--training", action="store_true",
|
|
help="Use training set instead of testing set")
|
|
|
|
parser.add_argument("--data", default="./data",
|
|
help="Path to MNIST data dir")
|
|
|
|
args = parser.parse_args()
|
|
|
|
mn = MNIST(args.data)
|
|
|
|
if args.training:
|
|
img, label = mn.load_training()
|
|
else:
|
|
img, label = mn.load_testing()
|
|
|
|
if args.id:
|
|
which = args.id
|
|
else:
|
|
which = random.randrange(0, len(label))
|
|
|
|
print('Showing num: {}'.format(label[which]))
|
|
print(mn.display(img[which]))
|