Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

68 lines
1.7KB

  1. from ui.app import App
  2. if __name__ == '__main__':
  3. app = App()
  4. app.mainloop()
  5. # import numpy as np
  6. # from matplotlib import pyplot as plt
  7. #
  8. # import matplotlib
  9. #
  10. # matplotlib.use("TkAgg")
  11. # np.random.seed(0)
  12. #
  13. # from utils.mnist import MNISTNeuralNet
  14. #
  15. # # Set the precision to 3 decimal places
  16. # np.set_printoptions(precision=8, suppress=True)
  17. #
  18. # from utils.load_mnist import get_test_images, get_test_labels, get_train_images, get_train_labels
  19. #
  20. # train_images = get_train_images()
  21. # train_labels = get_train_labels()
  22. #
  23. # mnist_neural_net = MNISTNeuralNet()
  24. # losses = mnist_neural_net.train(train_images, train_labels, 0.0001, 100)
  25. # test_images = get_test_images()
  26. # test_labels = get_test_labels()
  27. # results = mnist_neural_net.forward(test_images)
  28. # predictions = results.argmax(axis=1)
  29. #
  30. # correct = predictions == test_labels
  31. # incorrect = predictions != test_labels
  32. # accuracy = mnist_neural_net.accuracy(results, test_labels)
  33. # # Create figure and axes
  34. # fig, ax = plt.subplots(figsize=(10, 5))
  35. #
  36. # ax.hist(test_labels[correct], bins=np.arange(11)-0.5, alpha=0.5, label="Correct", color="green")
  37. # ax.hist(test_labels[incorrect], bins=np.arange(11)-0.5, alpha=0.5, label="Incorrect", color="red")
  38. # ax.set_xticks(range(10))
  39. # ax.set_xlabel("True Label")
  40. # ax.set_ylabel("Count")
  41. # ax.set_title(f"Accuracy {accuracy}")
  42. # ax.legend()
  43. #
  44. # fig.show()
  45. # while True:
  46. # plt.pause(0.1)
  47. ####################
  48. ## Draw image ##
  49. ####################
  50. # Create a figure and axes
  51. # fig, ax = plt.subplots()
  52. # Initial matrix displayed
  53. # initial_data = np.array(images[0])
  54. # mat = ax.matshow(initial_data.reshape(28, 28), cmap='bwr')
  55. # fig.show()
  56. # Redraw the canvas
  57. # fig.canvas.draw()
  58. # fig.canvas.flush_events()
  59. #
  60. # plt.pause(20)