-
Notifications
You must be signed in to change notification settings - Fork 0
/
MobileNetGraphs.py
66 lines (51 loc) · 14.2 KB
/
MobileNetGraphs.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import matplotlib.pyplot as plt
import numpy as np
acc = [[0.24425727128982544, 0.45099541544914246, 0.5222052335739136, 0.5918835997581482, 0.6140888333320618, 0.6523736715316772, 0.6692190170288086, 0.6852986216545105, 0.7113323211669922, 0.7350689172744751, 0.7480857372283936, 0.7833077907562256, 0.7986217737197876, 0.8047473430633545, 0.8376722931861877], [0.2536398470401764, 0.44674330949783325, 0.5256704688072205, 0.5716475248336792, 0.6160919666290283, 0.6337164640426636, 0.6796934604644775, 0.6919540166854858, 0.7042145729064941, 0.7417624592781067, 0.7524904012680054, 0.7647509574890137, 0.8107279539108276, 0.8061302900314331, 0.8390804529190063], [0.25631216168403625, 0.4667176604270935, 0.5325171947479248, 0.5707727670669556, 0.6120887398719788, 0.6541698575019836, 0.6679418683052063, 0.7084927558898926, 0.7245600819587708, 0.7505738139152527, 0.7666411399841309, 0.782708466053009, 0.8087222576141357, 0.824024498462677, 0.8355011343955994], [0.2647283971309662, 0.45371079444885254, 0.5424636602401733, 0.5983167290687561, 0.614384114742279, 0.6396327614784241, 0.6648814082145691, 0.7092578411102295, 0.7268553972244263, 0.7513389587402344, 0.7620505094528198, 0.7980107069015503, 0.8048967123031616, 0.8171384930610657, 0.8339709043502808], [0.2670237123966217, 0.4621270000934601, 0.5317521095275879, 0.5707727670669556, 0.6281560659408569, 0.6602907180786133, 0.6710022687911987, 0.7046671509742737, 0.7383320331573486, 0.7505738139152527, 0.7735271453857422, 0.790359616279602, 0.8102524876594543, 0.8087222576141357, 0.8278500437736511], [0.29762816429138184, 0.47666412591934204, 0.5439938902854919, 0.5776587724685669, 0.6128538846969604, 0.6641163229942322, 0.6755929589271545, 0.7000765204429626, 0.7276204824447632, 0.74521803855896, 0.7597551941871643, 0.7857689261436462, 0.7796480655670166, 0.8209640383720398, 0.8309105038642883], [0.2417750507593155, 0.45600610971450806, 0.5416985750198364, 0.5860750079154968, 0.6243305206298828, 0.6511093974113464, 0.68630450963974, 0.698546290397644, 0.7230298519134521, 0.7490435838699341, 0.7704667448997498, 0.778117835521698, 0.7941851615905762, 0.8064269423484802, 0.8408569097518921], [0.2195868343114853, 0.45906656980514526, 0.5386381149291992, 0.5921958684921265, 0.6136189699172974, 0.6465187668800354, 0.6725324988365173, 0.7092578411102295, 0.7299158573150635, 0.7467482686042786, 0.7704667448997498, 0.782708466053009, 0.8140780329704285, 0.8133129477500916, 0.8255547285079956], [0.2467532455921173, 0.4675324559211731, 0.5446906089782715, 0.5974025726318359, 0.6264324188232422, 0.6546982526779175, 0.6990068554878235, 0.6967150568962097, 0.7226890921592712, 0.7410236597061157, 0.7501909732818604, 0.7700534462928772, 0.7990832924842834, 0.8174178600311279, 0.8426279425621033], [0.23583461344242096, 0.447932630777359, 0.5306278467178345, 0.5551301836967468, 0.6094946265220642, 0.6401225328445435, 0.6577335596084595, 0.6868300437927246, 0.6990811824798584, 0.7381317019462585, 0.7450229525566101, 0.7641654014587402, 0.7963246703147888, 0.8323124051094055, 0.8200612664222717]]
val_acc = [[0.3561643958091736, 0.45890411734580994, 0.5410959124565125, 0.5479452013969421, 0.5479452013969421, 0.5616438388824463, 0.5821917653083801, 0.5821917653083801, 0.5890411138534546, 0.5958904027938843, 0.6095890402793884, 0.6027397513389587, 0.6164383292198181, 0.5958904027938843, 0.6164383292198181], [0.27210885286331177, 0.4217686951160431, 0.4625850319862366, 0.49659863114356995, 0.4897959232330322, 0.5170068144798279, 0.523809552192688, 0.5442177057266235, 0.5374149680137634, 0.5442177057266235, 0.557823121547699, 0.5646258592605591, 0.5918367505073547, 0.5850340127944946, 0.5782312750816345], [0.2896551787853241, 0.4206896424293518, 0.4689655303955078, 0.5034482479095459, 0.5586206912994385, 0.5517241358757019, 0.5517241358757019, 0.565517246723175, 0.5931034684181213, 0.5931034684181213, 0.6137930750846863, 0.6068965792655945, 0.6206896305084229, 0.6137930750846863, 0.6275861859321594], [0.33103448152542114, 0.475862056016922, 0.565517246723175, 0.6000000238418579, 0.5862069129943848, 0.6068965792655945, 0.6137930750846863, 0.6275861859321594, 0.6068965792655945, 0.6413792967796326, 0.634482741355896, 0.6620689630508423, 0.6482758522033691, 0.6551724076271057, 0.6620689630508423], [0.317241370677948, 0.4482758641242981, 0.5379310250282288, 0.5448275804519653, 0.5448275804519653, 0.5793103575706482, 0.5862069129943848, 0.6068965792655945, 0.5931034684181213, 0.6000000238418579, 0.6413792967796326, 0.6275861859321594, 0.6137930750846863, 0.6206896305084229, 0.6206896305084229], [0.3379310369491577, 0.4482758641242981, 0.5310344696044922, 0.5724138021469116, 0.5793103575706482, 0.6000000238418579, 0.6000000238418579, 0.6137930750846863, 0.6137930750846863, 0.6482758522033691, 0.634482741355896, 0.6482758522033691, 0.6551724076271057, 0.6551724076271057, 0.6896551847457886], [0.30344828963279724, 0.4137931168079376, 0.46206897497177124, 0.5517241358757019, 0.565517246723175, 0.5517241358757019, 0.6000000238418579, 0.5931034684181213, 0.6000000238418579, 0.5862069129943848, 0.6000000238418579, 0.6000000238418579, 0.6000000238418579, 0.6068965792655945, 0.6137930750846863], [0.3103448152542114, 0.4000000059604645, 0.4965517222881317, 0.5103448033332825, 0.517241358757019, 0.5241379141807556, 0.5241379141807556, 0.5310344696044922, 0.517241358757019, 0.5379310250282288, 0.5379310250282288, 0.5379310250282288, 0.5517241358757019, 0.5379310250282288, 0.5379310250282288], [0.32867133617401123, 0.46853145956993103, 0.5174825191497803, 0.5664335489273071, 0.5734265446662903, 0.5804196000099182, 0.5874125957489014, 0.6013985872268677, 0.6013985872268677, 0.6083915829658508, 0.6013985872268677, 0.6083915829658508, 0.6013985872268677, 0.6083915829658508, 0.6293706297874451], [0.3493150770664215, 0.4178082048892975, 0.4794520437717438, 0.5547945499420166, 0.568493127822876, 0.5821917653083801, 0.568493127822876, 0.5958904027938843, 0.6027397513389587, 0.5890411138534546, 0.6232876777648926, 0.6095890402793884, 0.6164383292198181, 0.6232876777648926, 0.6438356041908264]]
loss = [[2.164684534072876, 1.6823749542236328, 1.4499529600143433, 1.3017468452453613, 1.218446969985962, 1.143734097480774, 1.068498969078064, 1.0099971294403076, 0.9500000476837158, 0.879833996295929, 0.84294193983078, 0.782120406627655, 0.7304620742797852, 0.7046815752983093, 0.6407243609428406], [2.107367753982544, 1.6660951375961304, 1.4603089094161987, 1.3408676385879517, 1.225243330001831, 1.1447210311889648, 1.0459749698638916, 0.981718897819519, 0.9413822889328003, 0.8653842210769653, 0.8242959976196289, 0.7835348844528198, 0.7170583009719849, 0.6969518661499023, 0.6516651511192322], [2.1225030422210693, 1.650490403175354, 1.428426742553711, 1.3023231029510498, 1.2057020664215088, 1.1056386232376099, 1.0338542461395264, 0.9745196104049683, 0.9131184220314026, 0.8544598817825317, 0.7950859665870667, 0.76065993309021, 0.6819055676460266, 0.6682708263397217, 0.6261017322540283], [2.111293077468872, 1.650457501411438, 1.4278113842010498, 1.2939881086349487, 1.214673638343811, 1.1378270387649536, 1.0587704181671143, 0.9784529805183411, 0.9134042263031006, 0.8700148463249207, 0.8252884149551392, 0.75944983959198, 0.7182184457778931, 0.6808866858482361, 0.636814296245575], [2.079573392868042, 1.6032981872558594, 1.4289265871047974, 1.3155537843704224, 1.1775301694869995, 1.112839937210083, 1.0485612154006958, 0.972510576248169, 0.8955954313278198, 0.8674392104148865, 0.818695068359375, 0.7476758360862732, 0.7103229761123657, 0.6973791718482971, 0.623377799987793], [2.083557605743408, 1.6269593238830566, 1.4275153875350952, 1.3060927391052246, 1.220619559288025, 1.1004315614700317, 1.0401878356933594, 0.9878587126731873, 0.918070375919342, 0.8633416891098022, 0.8077623248100281, 0.7725122570991516, 0.7419185042381287, 0.6867635846138, 0.6399371027946472], [2.181114912033081, 1.6741453409194946, 1.4630249738693237, 1.3281302452087402, 1.2117866277694702, 1.11857271194458, 1.0496264696121216, 1.0079059600830078, 0.9294837117195129, 0.8746830821037292, 0.8104051947593689, 0.7664728760719299, 0.738682210445404, 0.6930761337280273, 0.6302359700202942], [2.1493070125579834, 1.6322270631790161, 1.4324498176574707, 1.2964445352554321, 1.2045966386795044, 1.1212825775146484, 1.0335807800292969, 0.9796605110168457, 0.9064815044403076, 0.8557479381561279, 0.8001440763473511, 0.7601040601730347, 0.6953176259994507, 0.6566055417060852, 0.6359540820121765], [2.109231472015381, 1.6250898838043213, 1.4206645488739014, 1.2895464897155762, 1.171992540359497, 1.1075197458267212, 1.0322176218032837, 0.9825333952903748, 0.9332060813903809, 0.8648771047592163, 0.8147820234298706, 0.7657642960548401, 0.7126044631004333, 0.6753607392311096, 0.6153708100318909], [2.1464767456054688, 1.6632027626037598, 1.4702842235565186, 1.3493164777755737, 1.2279963493347168, 1.147321343421936, 1.110257863998413, 1.0239310264587402, 0.9676938056945801, 0.9057068228721619, 0.8672407865524292, 0.8026795983314514, 0.7490979433059692, 0.6807273626327515, 0.6779788136482239]]
val_loss = [[1.9808610677719116, 1.5976287126541138, 1.4349112510681152, 1.3589462041854858, 1.3137246370315552, 1.2658497095108032, 1.2448136806488037, 1.2251625061035156, 1.1853870153427124, 1.1780402660369873, 1.1667519807815552, 1.1461379528045654, 1.1240577697753906, 1.1285529136657715, 1.1030312776565552], [2.0131752490997314, 1.6851816177368164, 1.5494043827056885, 1.4903384447097778, 1.4488002061843872, 1.4110785722732544, 1.384353518486023, 1.3626000881195068, 1.3485383987426758, 1.3285560607910156, 1.3176257610321045, 1.3078892230987549, 1.3079969882965088, 1.2977728843688965, 1.2976515293121338], [2.012127161026001, 1.6926920413970947, 1.532513976097107, 1.4460464715957642, 1.3693937063217163, 1.3321698904037476, 1.2808297872543335, 1.2712407112121582, 1.2388949394226074, 1.2147578001022339, 1.2016000747680664, 1.1716605424880981, 1.1610990762710571, 1.1359492540359497, 1.1283830404281616], [1.921385407447815, 1.5166163444519043, 1.3462436199188232, 1.2594079971313477, 1.2103123664855957, 1.1740962266921997, 1.1449438333511353, 1.1266895532608032, 1.1003590822219849, 1.0853264331817627, 1.0771695375442505, 1.045219898223877, 1.0393160581588745, 1.028171420097351, 1.0318074226379395], [1.933327317237854, 1.622042179107666, 1.4546287059783936, 1.367415189743042, 1.3269091844558716, 1.2928357124328613, 1.2633862495422363, 1.2472063302993774, 1.22898530960083, 1.2106542587280273, 1.20014488697052, 1.2007811069488525, 1.195261836051941, 1.1914223432540894, 1.2050573825836182], [1.9645979404449463, 1.5708987712860107, 1.395211935043335, 1.3087677955627441, 1.237005591392517, 1.1901025772094727, 1.1469957828521729, 1.1245250701904297, 1.0987859964370728, 1.0818232297897339, 1.0526092052459717, 1.042054533958435, 1.0335406064987183, 1.023995280265808, 0.9933459162712097], [2.0139870643615723, 1.6382484436035156, 1.4847338199615479, 1.3829063177108765, 1.333308219909668, 1.3001844882965088, 1.2481975555419922, 1.2333449125289917, 1.2017050981521606, 1.1858618259429932, 1.1689778566360474, 1.1478239297866821, 1.1415337324142456, 1.1383715867996216, 1.1068115234375], [2.0118184089660645, 1.713307499885559, 1.5295625925064087, 1.447532057762146, 1.3938316106796265, 1.3708707094192505, 1.3211932182312012, 1.311026930809021, 1.2858892679214478, 1.2757147550582886, 1.259987235069275, 1.2419772148132324, 1.2328182458877563, 1.234989881515503, 1.2364864349365234], [1.9405014514923096, 1.5601595640182495, 1.4278371334075928, 1.3438133001327515, 1.3032456636428833, 1.283956527709961, 1.2427767515182495, 1.2172483205795288, 1.202904462814331, 1.2030854225158691, 1.1803662776947021, 1.1724846363067627, 1.1625250577926636, 1.159104347229004, 1.15812349319458], [1.9582674503326416, 1.6072964668273926, 1.4244205951690674, 1.340579628944397, 1.2906498908996582, 1.2474520206451416, 1.2224489450454712, 1.2020268440246582, 1.184741497039795, 1.1726137399673462, 1.1641340255737305, 1.1507163047790527, 1.1310627460479736, 1.1287177801132202, 1.1190868616104126]]
accuracies = [0.6164383292198181, 0.5782312750816345, 0.6275861859321594, 0.6620689630508423, 0.6206896305084229, 0.6896551847457886, 0.6137930750846863, 0.5379310250282288, 0.6293706297874451, 0.6438356041908264]
losses = [1.1030313968658447, 1.2976514101028442, 1.1283830404281616, 1.0318074226379395, 1.2050573825836182, 0.9933460354804993, 1.1068115234375, 1.2364863157272339, 1.15812349319458, 1.1190871000289917]
mean_acc = np.mean(accuracies)
mean_losses = np.mean(losses)
print(mean_acc)
print(mean_losses)
'''
a = np.array(accuracies)
l = np.array(losses)
std_a = 2 * np.std(a)
std_l = 2 *np.std(l)
all_folds = ["fold0","fold1","fold2","fold3","fold4","fold5","fold6","fold7","fold8","fold9"]
# creating the bar plot
plt.bar(all_folds, accuracies,yerr = std_a, color ='blue',
width = 0.4,align='center', alpha=0.5, ecolor='black', capsize=10)
plt.xlabel("Fold Number")
plt.ylabel("Accuracy")
plt.title("Accuracy of Each Fold For MobileNet CNN")
plt.savefig("AMobileNet.png")
plt.close()
plt.bar(all_folds, losses,yerr = std_l, color ='maroon',
width = 0.4,align='center', alpha=0.5, ecolor='black', capsize=10)
plt.xlabel("Fold Number")
plt.ylabel("Loss")
plt.title("Loss of Each Fold For MobileNet CNN")
plt.savefig("LMobileNet.png")
plt.close()
epochs = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
plt.title('Model Accuracy For MobileNet')
plt.ylabel('accuracy')
plt.xlabel('epoch')
plt.legend(['train', 'test'], loc='upper left')
plt.plot(epochs,acc[0],'r',epochs,val_acc[0],'b',epochs,acc[1],'r',epochs,val_acc[1],'b',epochs,acc[2],'r',epochs,val_acc[2],'b',epochs,acc[3],'r',epochs,val_acc[3],'b',epochs,acc[4],'r',epochs,val_acc[4],'b',epochs,acc[5],'r',epochs,val_acc[5],'b'
,epochs,acc[6],'r',epochs,val_acc[6],'b',epochs,acc[7],'r',epochs,val_acc[7],'b',epochs,acc[8],'r',epochs,val_acc[8],'b',epochs,acc[9],'r',epochs,val_acc[9],'b')
plt.show()
plt.close()
plt.title('Model Loss For MobileNet')
plt.ylabel('loss')
plt.xlabel('epoch')
plt.legend(['train', 'test'], loc='upper left')
plt.plot(epochs,loss[0],'r',epochs,val_loss[0],'b',epochs,loss[1],'r',epochs,val_loss[1],'b',epochs,loss[2],'r',epochs,val_loss[2],'b',epochs,loss[3],'r',epochs,val_loss[3],'b',epochs,loss[4],'r',epochs,val_loss[4],'b',epochs,loss[5],'r',epochs,val_loss[5],'b'
,epochs,loss[6],'r',epochs,val_loss[6],'b',epochs,loss[7],'r',epochs,val_loss[7],'b',epochs,loss[8],'r',epochs,val_loss[8],'b',epochs,loss[9],'r',epochs,val_loss[9],'b')
plt.show()
plt.close()
'''