limited versions!

main
Brett 2025-01-09 13:57:04 -05:00
parent 10dc129e18
commit dbe3638c7a
72 changed files with 2340 additions and 16 deletions

View File

@ -2,6 +2,18 @@
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/cmake-build-debug/_deps/freetype-src" vcs="Git" />
<mapping directory="$PROJECT_DIR$/cmake-build-debug/_deps/freetype-src/subprojects/dlg" vcs="Git" />
<mapping directory="$PROJECT_DIR$/cmake-build-debug/_deps/imgui-src" vcs="Git" />
<mapping directory="$PROJECT_DIR$/cmake-build-release/_deps/freetype-src" vcs="Git" />
<mapping directory="$PROJECT_DIR$/cmake-build-release/_deps/freetype-src/subprojects/dlg" vcs="Git" />
<mapping directory="$PROJECT_DIR$/cmake-build-release/_deps/imgui-src" vcs="Git" />
<mapping directory="$PROJECT_DIR$/cmake-build-relwithdebinfo-addrsan/_deps/freetype-src" vcs="Git" />
<mapping directory="$PROJECT_DIR$/cmake-build-relwithdebinfo-addrsan/_deps/freetype-src/subprojects/dlg" vcs="Git" />
<mapping directory="$PROJECT_DIR$/cmake-build-relwithdebinfo-addrsan/_deps/imgui-src" vcs="Git" />
<mapping directory="$PROJECT_DIR$/cmake-build-relwithdebinfo/_deps/freetype-src" vcs="Git" />
<mapping directory="$PROJECT_DIR$/cmake-build-relwithdebinfo/_deps/freetype-src/subprojects/dlg" vcs="Git" />
<mapping directory="$PROJECT_DIR$/cmake-build-relwithdebinfo/_deps/imgui-src" vcs="Git" />
<mapping directory="$PROJECT_DIR$/lib/blt-with-graphics" vcs="Git" />
<mapping directory="$PROJECT_DIR$/lib/blt-with-graphics/libraries/BLT" vcs="Git" />
<mapping directory="$PROJECT_DIR$/lib/blt-with-graphics/libraries/BLT/libraries/parallel-hashmap" vcs="Git" />

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.25)
project(COSC-4P80-Final-Project VERSION 0.0.23)
project(COSC-4P80-Final-Project VERSION 0.0.24)
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)

View File

@ -2,7 +2,7 @@ import matplotlib.pyplot as plt
import pandas as pd
import sys
def plot_stacked_graph(title, output, csv_file1, csv_file2, position, position2):
def plot_stacked_graph(title, output, csv_file1, csv_file2, name1, name2):
# Read CSV files
data1 = pd.read_csv(csv_file1, header=0)
data2 = pd.read_csv(csv_file2, header=0)
@ -18,27 +18,27 @@ def plot_stacked_graph(title, output, csv_file1, csv_file2, position, position2)
# Create the plot
fig, ax = plt.subplots()
ax.plot(x1, y1, label=f"{csv_file1}")
ax.plot(x2, y2, label=f"{csv_file2}")
ax.plot(x1, y1, label=f"{name1}")
ax.plot(x2, y2, label=f"{name2}")
if position < 2 ** 32:
ax.axvline(x=position, color='red', linestyle='--')
ax.text(position, ax.get_ylim()[1] * 0.95, f"Feed-forward average # of epochs", color='red', fontsize=10, ha='right', va='top', backgroundcolor='white')
# if position < 2 ** 32:
# ax.axvline(x=position, color='red', linestyle='--')
# ax.text(position, ax.get_ylim()[1] * 0.95, f"Feed-forward average # of epochs", color='red', fontsize=10, ha='right', va='top', backgroundcolor='white')
if position2 < 2 ** 32:
ax.axvline(x=position2, color='red', linestyle='--')
ax.text(position2, ax.get_ylim()[1] * 0.95, f"Deep learning average # of epochs", color='red', fontsize=10, ha='right', va='top', backgroundcolor='white')
# if position2 < 2 ** 32:
# ax.axvline(x=position2, color='red', linestyle='--')
# ax.text(position2, ax.get_ylim()[1] * 0.95, f"Deep learning average # of epochs", color='red', fontsize=10, ha='right', va='top', backgroundcolor='white')
ax.set_xlabel(x1_label)
ax.set_ylabel(y1_label)
# ax.legend()
ax.set_title(title)
ax.legend()
ax.set_title(title, fontsize=12)
plt.savefig(output)
if __name__ == "__main__":
if len(sys.argv) != 7:
print("Usage: python script.py <title> <output_file> <csv_file1> <csv_file2> <position_feed_forward> <position_deep>")
print("Usage: python script.py <title> <output_file> <csv_file1> <csv_file2> <csv1_name> <csv2_name>")
sys.exit(1)
csv_file1 = sys.argv[3]
@ -48,4 +48,4 @@ if __name__ == "__main__":
position = sys.argv[5]
position2 = sys.argv[6]
plot_stacked_graph(title, output, csv_file1, csv_file2, int(position), int(position2))
plot_stacked_graph(title, output, csv_file1, csv_file2, position, position2)

1
part1/average_epochs.txt Normal file
View File

@ -0,0 +1 @@
1000,1000

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,101 @@
Epoch,Loss
0,0.467267
1,0.290678
2,0.207312
3,0.0649596
4,0.0599905
5,0.0543778
6,0.0424468
7,0.0403263
8,0.0378105
9,0.0316262
10,0.030276
11,0.0285475
12,0.0243477
13,0.0233952
14,0.0222361
15,0.0193495
16,0.0187022
17,0.0179005
18,0.0157537
19,0.0152478
20,0.0146454
21,0.0129936
22,0.0126169
23,0.0121665
24,0.0109912
25,0.0106991
26,0.0103499
27,0.00939932
28,0.00917552
29,0.00890531
30,0.00822634
31,0.00804983
32,0.00783543
33,0.00727694
34,0.00714944
35,0.0069743
36,0.00651646
37,0.00638716
38,0.0062143
39,0.00583569
40,0.0057501
41,0.00563407
42,0.00535179
43,0.00527912
44,0.00518645
45,0.00492411
46,0.00486457
47,0.00479207
48,0.00457332
49,0.00452252
50,0.0044633
51,0.00427591
52,0.00423684
53,0.00419028
54,0.00405542
55,0.00402287
56,0.00398389
57,0.00388008
58,0.00385705
59,0.00383098
60,0.00375437
61,0.003736
62,0.00371335
63,0.00365119
64,0.00363692
65,0.00362008
66,0.00356688
67,0.00355586
68,0.00354138
69,0.00349546
70,0.00348745
71,0.0034773
72,0.00344903
73,0.00343734
74,0.00342712
75,0.0033967
76,0.00339011
77,0.0033799
78,0.00335454
79,0.00335041
80,0.00334154
81,0.00332021
82,0.00331562
83,0.00330733
84,0.00328681
85,0.00328304
86,0.0032763
87,0.00326311
88,0.00325899
89,0.003252
90,0.00324033
91,0.0032339
92,0.00322834
93,0.00321506
94,0.0032241
95,0.00323033
96,0.0032095
97,0.00320514
98,0.00321329
99,0.00318569
1 Epoch Loss
2 0 0.467267
3 1 0.290678
4 2 0.207312
5 3 0.0649596
6 4 0.0599905
7 5 0.0543778
8 6 0.0424468
9 7 0.0403263
10 8 0.0378105
11 9 0.0316262
12 10 0.030276
13 11 0.0285475
14 12 0.0243477
15 13 0.0233952
16 14 0.0222361
17 15 0.0193495
18 16 0.0187022
19 17 0.0179005
20 18 0.0157537
21 19 0.0152478
22 20 0.0146454
23 21 0.0129936
24 22 0.0126169
25 23 0.0121665
26 24 0.0109912
27 25 0.0106991
28 26 0.0103499
29 27 0.00939932
30 28 0.00917552
31 29 0.00890531
32 30 0.00822634
33 31 0.00804983
34 32 0.00783543
35 33 0.00727694
36 34 0.00714944
37 35 0.0069743
38 36 0.00651646
39 37 0.00638716
40 38 0.0062143
41 39 0.00583569
42 40 0.0057501
43 41 0.00563407
44 42 0.00535179
45 43 0.00527912
46 44 0.00518645
47 45 0.00492411
48 46 0.00486457
49 47 0.00479207
50 48 0.00457332
51 49 0.00452252
52 50 0.0044633
53 51 0.00427591
54 52 0.00423684
55 53 0.00419028
56 54 0.00405542
57 55 0.00402287
58 56 0.00398389
59 57 0.00388008
60 58 0.00385705
61 59 0.00383098
62 60 0.00375437
63 61 0.003736
64 62 0.00371335
65 63 0.00365119
66 64 0.00363692
67 65 0.00362008
68 66 0.00356688
69 67 0.00355586
70 68 0.00354138
71 69 0.00349546
72 70 0.00348745
73 71 0.0034773
74 72 0.00344903
75 73 0.00343734
76 74 0.00342712
77 75 0.0033967
78 76 0.00339011
79 77 0.0033799
80 78 0.00335454
81 79 0.00335041
82 80 0.00334154
83 81 0.00332021
84 82 0.00331562
85 83 0.00330733
86 84 0.00328681
87 85 0.00328304
88 86 0.0032763
89 87 0.00326311
90 88 0.00325899
91 89 0.003252
92 90 0.00324033
93 91 0.0032339
94 92 0.00322834
95 93 0.00321506
96 94 0.0032241
97 95 0.00323033
98 96 0.0032095
99 97 0.00320514
100 98 0.00321329
101 99 0.00318569

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

1035
part1/feed_forward/state.bin Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,101 @@
Epoch,Loss
0,0.699479
1,0.496314
2,0.410334
3,0.358543
4,0.322386
5,0.295046
6,0.27331
7,0.255423
8,0.240327
9,0.227347
10,0.216018
11,0.206008
12,0.197078
13,0.189043
14,0.181763
15,0.175128
16,0.169047
17,0.163448
18,0.158271
19,0.153466
20,0.148992
21,0.144812
22,0.140896
23,0.137217
24,0.133754
25,0.130487
26,0.127397
27,0.124471
28,0.121694
29,0.119055
30,0.116543
31,0.114149
32,0.111865
33,0.109682
34,0.107593
35,0.105593
36,0.103676
37,0.101836
38,0.10007
39,0.0983709
40,0.0967364
41,0.0951626
42,0.0936461
43,0.0921836
44,0.0907725
45,0.0894097
46,0.088093
47,0.08682
48,0.0855883
49,0.0843962
50,0.0832418
51,0.0821232
52,0.0810387
53,0.0799869
54,0.0789662
55,0.0779754
56,0.077013
57,0.0760781
58,0.0751694
59,0.0742859
60,0.0734264
61,0.0725901
62,0.0717762
63,0.0709837
64,0.0702117
65,0.0694594
66,0.0687262
67,0.0680115
68,0.0673145
69,0.0666345
70,0.0659711
71,0.0653235
72,0.0646913
73,0.064074
74,0.063471
75,0.0628818
76,0.062306
77,0.0617431
78,0.0611928
79,0.0606546
80,0.0601282
81,0.0596132
82,0.0591092
83,0.0586158
84,0.0416983
85,0.0168184
86,0.0174127
87,0.0173631
88,0.0173133
89,0.0172655
90,0.017219
91,0.0171735
92,0.0171297
93,0.0170865
94,0.0170442
95,0.017003
96,0.0169629
97,0.0169233
98,0.0168849
99,0.0168473
1 Epoch Loss
2 0 0.699479
3 1 0.496314
4 2 0.410334
5 3 0.358543
6 4 0.322386
7 5 0.295046
8 6 0.27331
9 7 0.255423
10 8 0.240327
11 9 0.227347
12 10 0.216018
13 11 0.206008
14 12 0.197078
15 13 0.189043
16 14 0.181763
17 15 0.175128
18 16 0.169047
19 17 0.163448
20 18 0.158271
21 19 0.153466
22 20 0.148992
23 21 0.144812
24 22 0.140896
25 23 0.137217
26 24 0.133754
27 25 0.130487
28 26 0.127397
29 27 0.124471
30 28 0.121694
31 29 0.119055
32 30 0.116543
33 31 0.114149
34 32 0.111865
35 33 0.109682
36 34 0.107593
37 35 0.105593
38 36 0.103676
39 37 0.101836
40 38 0.10007
41 39 0.0983709
42 40 0.0967364
43 41 0.0951626
44 42 0.0936461
45 43 0.0921836
46 44 0.0907725
47 45 0.0894097
48 46 0.088093
49 47 0.08682
50 48 0.0855883
51 49 0.0843962
52 50 0.0832418
53 51 0.0821232
54 52 0.0810387
55 53 0.0799869
56 54 0.0789662
57 55 0.0779754
58 56 0.077013
59 57 0.0760781
60 58 0.0751694
61 59 0.0742859
62 60 0.0734264
63 61 0.0725901
64 62 0.0717762
65 63 0.0709837
66 64 0.0702117
67 65 0.0694594
68 66 0.0687262
69 67 0.0680115
70 68 0.0673145
71 69 0.0666345
72 70 0.0659711
73 71 0.0653235
74 72 0.0646913
75 73 0.064074
76 74 0.063471
77 75 0.0628818
78 76 0.062306
79 77 0.0617431
80 78 0.0611928
81 79 0.0606546
82 80 0.0601282
83 81 0.0596132
84 82 0.0591092
85 83 0.0586158
86 84 0.0416983
87 85 0.0168184
88 86 0.0174127
89 87 0.0173631
90 88 0.0173133
91 89 0.0172655
92 90 0.017219
93 91 0.0171735
94 92 0.0171297
95 93 0.0170865
96 94 0.0170442
97 95 0.017003
98 96 0.0169629
99 97 0.0169233
100 98 0.0168849
101 99 0.0168473

BIN
part1/silly.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -0,0 +1,9 @@
\begin{figure}
\begin{tabular}{|c|c|c|c|}
\hline
Test & Correct & Incorrect & Accuracy (\%) \\
\hline
Feed-Forward & 9800 & 199 & 98\\
Deep Learning & 9898 & 101 & 99\\
\end{tabular}
\end{figure}

View File

@ -684,6 +684,34 @@ namespace fp
return run_network_tests<net_type_ff>(path, "feed_forward", runs, restore);
}
auto run_deep_learning_tests_v2(const std::string& path, const blt::i32 runs, const bool restore)
{
using namespace dlib;
using net_type_dl = loss_multiclass_log<
fc<10,
relu<fc<16,
relu<fc<16,
max_pool<2, 2, 2, 2, relu<con<16, 5, 5, 1, 1,
max_pool<2, 2, 2, 2, relu<con<6, 5, 5, 1, 1,
input<matrix<blt::u8>>>>>>>>>>>>>>;
BLT_TRACE("Running deep learning tests");
return run_network_tests<net_type_dl>(path, "deep_learning", runs, restore);
}
auto run_feed_forward_tests_v2(const std::string& path, const blt::i32 runs, const bool restore)
{
using namespace dlib;
using net_type_ff = loss_multiclass_log<
fc<10,
relu<fc<16,
relu<fc<16,
input<matrix<blt::u8>>>>>>>>;
BLT_TRACE("Running feed forward tests");
return run_network_tests<net_type_ff>(path, "feed_forward", runs, restore);
}
void run_mnist(const int argc, const char** argv)
{
binary_directory = std::filesystem::current_path();
@ -756,8 +784,10 @@ namespace fp
const auto restore = args.get<bool>("restore");
auto path = binary_directory + args.get<std::string>("network");
auto [deep_stats, deep_tests] = run_deep_learning_tests(path, runs, restore);
auto [forward_stats, forward_tests] = run_feed_forward_tests(path, runs, restore);
// auto [deep_stats, deep_tests] = run_deep_learning_tests(path, runs, restore);
auto [forward_stats, forward_tests] = run_feed_forward_tests_v2(path, runs, restore);
auto [deep_stats, deep_tests] = run_deep_learning_tests_v2(path, runs, restore);
// auto [forward_stats, forward_tests] = run_feed_forward_tests(path, runs, restore);
auto average_forward_size = forward_stats.average_size();
auto average_deep_size = deep_stats.average_size();