-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
51 lines (42 loc) · 1.85 KB
/
main.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import numpy as np
from deepscribe import DeepScribe
import mnist
import feature_extraction
from matplotlib import pyplot
import neural_network
import analysis
def run():
# Code to build resnet18:
# X, y, classes = neural_network.get_x_y_arrays('imgs_gray.npy', 'labels_gray.npy', n='all')
# X = np.load("output/imgs_gray.npy")
# y = np.load("output/labels_gray.npy")
# neural_network.train(X, y, "output/resnet18_073120.h5")
analysis.show_reports("output/split_data_resnet18_080720_tf2_dataAug.npz", "output/label_encoding_073120.npy", "output/resnet18_080720_tf2_dataAug.h5")
# analysis.get_training_curves("records/training_output_resnet18_080520_tf2_lastDropOut075.txt", 20, 213)
# Code to build mnist model:
# X, y = mnist.dict_to_np_arrays("output/img_data1.npy", "output/label_data1.npy") # run with -l max for all symbols
# X = np.load("output/img_data_gray.npy")
# y = np.load("output/label_data_gray.npy")
# mnist.run_mnist(X, y, "output/MNIST_model_on_OCHRE_100_epochs")
# mnist.show_classification_report(X, y, "output/MNIST_model_on_OCHRE_100_epochs")
# mnist.get_training_curve("records/training_output_100_epochs.txt")
# Code to test feature extraction:
# feature_extraction.extract_features("output/vgg16_fts_color.npy")
# Code to show feature maps - does not work:
# X = np.load("output/vgg16_fts_color.npy")
# print(X.shape)
# for fmap in X:
# ix = 1
# for i in range(8):
# for i in range(8):
# ax = pyplot.subplot(8,8,ix)
# ax.set_xticks([])
# ax.set_yticks([])
# pyplot.imshow(fmap[0,:,:])
# ix += 1
# pyplot.show()
# Code for random forest:
# y = np.load("output/label_data_gray.npy")
# feature_extraction.random_forest(X, y)
if __name__ == '__main__':
run()