from ui.app import App if __name__ == '__main__': app = App() app.mainloop() # import numpy as np # from matplotlib import pyplot as plt # # import matplotlib # # matplotlib.use("TkAgg") # np.random.seed(0) # # from utils.mnist import MNISTNeuralNet # # # Set the precision to 3 decimal places # np.set_printoptions(precision=8, suppress=True) # # from utils.load_mnist import get_test_images, get_test_labels, get_train_images, get_train_labels # # train_images = get_train_images() # train_labels = get_train_labels() # # mnist_neural_net = MNISTNeuralNet() # losses = mnist_neural_net.train(train_images, train_labels, 0.0001, 100) # test_images = get_test_images() # test_labels = get_test_labels() # results = mnist_neural_net.forward(test_images) # predictions = results.argmax(axis=1) # # correct = predictions == test_labels # incorrect = predictions != test_labels # accuracy = mnist_neural_net.accuracy(results, test_labels) # # Create figure and axes # fig, ax = plt.subplots(figsize=(10, 5)) # # ax.hist(test_labels[correct], bins=np.arange(11)-0.5, alpha=0.5, label="Correct", color="green") # ax.hist(test_labels[incorrect], bins=np.arange(11)-0.5, alpha=0.5, label="Incorrect", color="red") # ax.set_xticks(range(10)) # ax.set_xlabel("True Label") # ax.set_ylabel("Count") # ax.set_title(f"Accuracy {accuracy}") # ax.legend() # # fig.show() # while True: # plt.pause(0.1) #################### ## Draw image ## #################### # Create a figure and axes # fig, ax = plt.subplots() # Initial matrix displayed # initial_data = np.array(images[0]) # mat = ax.matshow(initial_data.reshape(28, 28), cmap='bwr') # fig.show() # Redraw the canvas # fig.canvas.draw() # fig.canvas.flush_events() # # plt.pause(20)