#%%
#画准确率
import matplotlib.pyplot as plt
DC_Lenet_loss = [1.2643316984176636,
0.2283182293176651,
0.12216257303953171,
0.08079160004854202,
0.052138801664114,
0.043818093836307526,
0.06142473593354225,
0.030448462814092636,
0.04590311646461487,
0.011799699626863003,
0.04369039833545685,
0.004672783426940441,
0.011384231969714165,
0.003681932343170047,
0.009126015938818455,
0.011850055307149887,
0.013928309082984924,
0.021303657442331314,
0.007936381734907627,
0.0009685035329312086,
0.03254784643650055,
0.01580597274005413,
0.007339192554354668,
0.002619170816615224,
0.007569409906864166,
0.036259427666664124,
0.020010150969028473,
0.025920724496245384,
0.00796118937432766,
0.00233394093811512,
0.0001532955648144707,
1.9636223441921175e-05,
8.743346370465588e-06,
5.348452305042883e-06,
3.8103135011624545e-06,
2.5622346129239304e-06,
2.0389222754602088e-06,
1.676341184975172e-06,
1.4393428955372656e-06,
1.0936258831861778e-06,
1.2821271866414463e-06,
8.161021014529979e-07,
7.196492788352771e-07,
6.362920430547092e-07,
5.978577632959059e-07,
5.966372782495455e-07,
5.581309210356267e-07,
4.884363420387672e-07,
5.116847887620679e-07,
3.89941760658985e-07,
5.124563813296845e-07,
3.4183599950665666e-07,
3.0813146167929517e-07,
2.8027417897646956e-07,
2.797293348066887e-07,
2.942086609891703e-07,
1.915655758466528e-07,
2.0218639917857217e-07,
3.3972483493016625e-07,
2.047832907692282e-07,
1.7128706986113684e-07,
1.9247741533945373e-07,
1.7564295262673113e-07,
1.712967474531979e-07,
2.2254307907587645e-07,
1.46014215829382e-07,
1.222788483801196e-07,
1.714822985832143e-07,
1.3390851449912589e-07,
9.798837652397197e-08,
1.0927161042673106e-07,
1.544363925631842e-07,
8.508800419804174e-08,
7.93658614384185e-08,
9.749783203005791e-08,
9.801372868878389e-08,
8.083636515721082e-08,
6.94981849846954e-08,
6.919351136502883e-08,
7.14058359108094e-08,
6.657106865759488e-08,
9.966888825374554e-08,
7.259674106308012e-08,
6.916675943102746e-08,
5.050452855925869e-08,
5.947146064499975e-08,
5.752465170871801e-08,
5.363043698025649e-08,
4.078257731521262e-08,
4.430586031389794e-08,
4.759066385418009e-08,
3.41996653219212e-08,
3.2835405505693416e-08,
4.061030978164126e-08,
3.503414092165258e-08,
3.769637757500277e-08,
4.400095932055592e-08,
3.409361681860901e-08,
3.637178025428511e-08,
3.1908115261103376e-08,
2.9656542110956252e-08,
2.9100176490715057e-08,
3.1947926970588014e-08,
2.831871626085558e-08,
2.4398097764333215e-08,
2.5232502309791016e-08,
2.4358328687412723e-08,
2.2967585167066318e-08,
2.5311997831067856e-08,
3.042464413738344e-08,
2.0967537039950912e-08,
1.8676068691547698e-08,
2.527227316306835e-08,
1.945753957954821e-08,
1.747074840352525e-08,
1.604023935897203e-08,
2.204031623875835e-08,
1.7536960328357054e-08,
1.5470693170982486e-08,
1.5854784152224966e-08]
DC_Lenet_accuracy = [0.5788888931274414,
0.925777792930603,
0.9595555663108826,
0.9754444360733032,
0.9847777485847473,
0.9871110916137695,
0.9821110963821411,
0.9908888936042786,
0.9858888983726501,
0.9971110820770264,
0.9872221946716309,
0.9987778067588806,
0.9963333606719971,
0.9990000128746033,
0.9974444508552551,
0.9968888759613037,
0.9963333606719971,
0.9936666488647461,
0.9976666569709778,
0.999666690826416,
0.9902222156524658,
0.9964444637298584,
0.9978888630867004,
0.9990000128746033,
0.9976666569709778,
0.9895555377006531,
0.9940000176429749,
0.9919999837875366,
0.9980000257492065,
0.9994444251060486,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0]
DC_Lenet_val_loss = [0.34025800228118896,
0.2008233368396759,
0.15720084309577942,
0.08770259469747543,
0.0598313994705677,
0.08123853802680969,
0.058860693126916885,
0.10517644137144089,
0.031136466190218925,
0.030388623476028442,
0.040747106075286865,
0.03638586029410362,
0.03049595095217228,
0.029948219656944275,
0.04834936931729317,
0.06104891374707222,
0.03899984806776047,
0.052707500755786896,
0.025189202278852463,
0.02602788805961609,
0.04615297541022301,
0.06056841090321541,
0.025089828297495842,
0.025539809837937355,
0.08016728609800339,
0.03209373354911804,
0.06334464997053146,
0.03148066624999046,
0.023591522127389908,
0.026868706569075584,
0.025230882689356804,
0.02525266259908676,
0.026213543489575386,
0.027096763253211975,
0.028181592002511024,
0.02858084626495838,
0.028847701847553253,
0.02912006340920925,
0.0292221587151289,
0.029464729130268097,
0.02961648255586624,
0.02996545098721981,
0.030305491760373116,
0.030594980344176292,
0.030586494132876396,
0.030940566211938858,
0.031274598091840744,
0.03137286752462387,
0.03146801143884659,
0.03148011863231659,
0.03169422224164009,
0.03166869282722473,
0.032047342509031296,
0.03219061717391014,
0.032307811081409454,
0.0323001891374588,
0.03257570415735245,
0.032608650624752045,
0.03264150768518448,
0.03266677260398865,
0.033065348863601685,
0.03327450528740883,
0.03355896845459938,
0.034170251339673996,
0.033614497631788254,
0.033864397555589676,
0.033889271318912506,
0.03410664200782776,
0.034033842384815216,
0.03419746086001396,
0.0341573990881443,
0.03457053005695343,
0.034684594720602036,
0.03463394567370415,
0.03497588634490967,
0.03484368696808815,
0.03511801362037659,
0.03523186966776848,
0.035192131996154785,
0.03550846129655838,
0.03550492599606514,
0.03529547527432442,
0.035253413021564484,
0.03558958321809769,
0.03556109964847565,
0.036050066351890564,
0.03603565692901611,
0.03593912348151207,
0.036107491701841354,
0.036216314882040024,
0.036330610513687134,
0.03637993335723877,
0.03640785068273544,
0.03651236742734909,
0.036505334079265594,
0.03665459528565407,
0.03674463927745819,
0.0368761271238327,
0.03717459365725517,
0.037092406302690506,
0.03711364418268204,
0.037237249314785004,
0.03734385222196579,
0.03719954192638397,
0.03723977133631706,
0.03730786219239235,
0.03727459907531738,
0.03730235621333122,
0.037192024290561676,
0.03769199550151825,
0.03769392520189285,
0.03754895180463791,
0.03788985311985016,
0.03783818706870079,
0.03758716210722923,
0.03777739033102989,
0.037556156516075134,
0.03780413046479225,
0.037890028208494186,
0.037922266870737076]
DC_Lenet_val_accuracy = [0.9016666412353516,
0.9315000176429749,
0.9456666707992554,
0.9756666421890259,
0.9831666946411133,
0.9761666655540466,
0.9804999828338623,
0.9739999771118164,
0.9919999837875366,
0.9936666488647461,
0.9883333444595337,
0.9903333187103271,
0.9916666746139526,
0.9918333292007446,
0.9884999990463257,
0.9816666841506958,
0.9896666407585144,
0.984000027179718,
0.9931666851043701,
0.9943333268165588,
0.9860000014305115,
0.9831666946411133,
0.9934999942779541,
0.9955000281333923,
0.9815000295639038,
0.9915000200271606,
0.9826666712760925,
0.9923333525657654,
0.9958333373069763,
0.9951666593551636,
0.9958333373069763,
0.9958333373069763,
0.9959999918937683,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9959999918937683,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9959999918937683,
0.9959999918937683,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9959999918937683,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9959999918937683,
0.9959999918937683,
0.9959999918937683,
0.9961666464805603,
0.9959999918937683,
0.9961666464805603,
0.9959999918937683,
0.9959999918937683,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9959999918937683,
0.9959999918937683,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603,
0.9961666464805603]
plt.subplot(1, 2, 1)
plt.plot(DC_Lenet_accuracy, label='Training Accuracy')
plt.plot(DC_Lenet_val_accuracy, label='Validation Accuracy')
plt.title('Training and Validation Accuracy')
plt.legend()
plt.subplot(1, 2, 2)
plt.plot(DC_Lenet_loss, label='Training Loss')
plt.plot(DC_Lenet_val_loss, label='Validation Loss')
plt.title('Training and Validation Loss')
plt.legend()
plt.show()
#%%
#LeNet5数据
Lenet_loss = [2.480301856994629,
1.9232763051986694,
1.6309425830841064,
1.4303404092788696,
1.2590162754058838,
1.0865615606307983,
0.9081703424453735,
0.7543668150901794,
0.6198376417160034,
0.5129042863845825,
0.43932145833969116,
0.36941590905189514,
0.3186129331588745,
0.27042216062545776,
0.2346709817647934,
0.20496737957000732,
0.17788735032081604,
0.15565508604049683,
0.13460586965084076,
0.11921116709709167,
0.09864387661218643,
0.08657749742269516,
0.07818103581666946,
0.06740394234657288,
0.05895012617111206,
0.05117960646748543,
0.04541235789656639,
0.039730917662382126,
0.034453749656677246,
0.03050997294485569,
0.02756480500102043,
0.024920986965298653,
0.021867619827389717,
0.019662629812955856,
0.017663871869444847,
0.01609816588461399,
0.014682137407362461,
0.013177668675780296,
0.012120489031076431,
0.011442148126661777,
0.010409689508378506,
0.009649370796978474,
0.008934436365962029,
0.008264429867267609,
0.0077086519449949265,
0.007137226406484842,
0.0067432476207613945,
0.006213882006704807,
0.005802598781883717,
0.0054162428714334965,
0.0050412011332809925,
0.004737230949103832,
0.0044521489180624485,
0.004172997549176216,
0.003918310161679983,
0.003707097377628088,
0.0034997286275029182,
0.0032893307507038116,
0.003126966068521142,
0.002940554404631257,
0.002776087960228324,
0.002670643152669072,
0.0025071462150663137,
0.0023854849860072136,
0.0022524078376591206,
0.002142059849575162,
0.002040577819570899,
0.0019314392702654004,
0.0018303394317626953,
0.0017444349359720945,
0.0016684271395206451,
0.0015792003832757473,
0.001504773274064064,
0.0014386957045644522,
0.0013764629838988185,
0.001307677710428834,
0.0012494662078097463,
0.001193505129776895,
0.0011369158746674657,
0.001089382218196988,
0.001041149371303618,
0.00099710572976619,
0.0009475619881413877,
0.0009084671037271619,
0.000866737391334027,
0.0008320622728206217,
0.0007994592888280749,
0.0007617902010679245,
0.000728420855011791,
0.0006982095073908567,
0.0006674501346424222,
0.0006388882175087929,
0.000613271608017385,
0.0005883908015675843,
0.0005656961584463716,
0.0005407424760051072,
0.000516529951710254,
0.000493752711918205,
0.0004755109257530421,
0.00045583545579575,
0.0004364662745501846,
0.000419067480834201,
0.0004018173785880208,
0.00038516634958796203,
0.000369463610695675,
0.00035346075310371816,
0.00033970584627240896,
0.00032739972812123597,
0.0003129041288048029,
0.0003009242645930499,
0.00028920118347741663,
0.0002774772292468697,
0.00026705185882747173,
0.0002565672330092639,
0.00024682722869329154,
0.00023690321540925652,
0.00022698465909343213,
0.00021912904048804194,
0.00020959434914402664,
0.0002022379485424608]
Lenet_accuracy = [0.24755555391311646,
0.46755555272102356,
0.5328888893127441,
0.5893333554267883,
0.6423333287239075,
0.6990000009536743,
0.7558888792991638,
0.7998889088630676,
0.8401111364364624,
0.8725555539131165,
0.8894444704055786,
0.9102222323417664,
0.9228888750076294,
0.9374444484710693,
0.9485555291175842,
0.9566666483879089,
0.9649999737739563,
0.9721111059188843,
0.9776666760444641,
0.9800000190734863,
0.9853333234786987,
0.9893333315849304,
0.9901111125946045,
0.992222249507904,
0.9943333268165588,
0.9957777857780457,
0.9965555667877197,
0.9977777600288391,
0.9978888630867004,
0.9987778067588806,
0.9991111159324646,
0.9992222189903259,
0.9992222189903259,
0.9995555281639099,
0.999666690826416,
0.999666690826416,
0.999666690826416,
0.999666690826416,
0.999666690826416,
0.999666690826416,
0.999666690826416,
0.999666690826416,
0.999666690826416,
0.999666690826416,
0.9997777938842773,
0.9997777938842773,
0.9998888969421387,
0.9997777938842773,
0.9998888969421387,
0.9998888969421387,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0]
Lenet_val_loss = [2.1577064990997314,
1.7788585424423218,
1.5719850063323975,
1.3685617446899414,
1.2239562273025513,
1.0623668432235718,
0.9053615927696228,
0.7270113825798035,
0.6155110001564026,
0.5373040437698364,
0.4785541296005249,
0.42799752950668335,
0.38325944542884827,
0.3532828390598297,
0.3199622929096222,
0.3042176365852356,
0.2910204231739044,
0.273141086101532,
0.25781989097595215,
0.24723660945892334,
0.24350933730602264,
0.22695761919021606,
0.2255372852087021,
0.21320493519306183,
0.2216726541519165,
0.2048099786043167,
0.2005772441625595,
0.20080961287021637,
0.198076069355011,
0.19401784241199493,
0.1941947191953659,
0.19085471332073212,
0.19086496531963348,
0.19237758219242096,
0.18830882012844086,
0.1901606023311615,
0.18892081081867218,
0.18622644245624542,
0.18993334472179413,
0.18857651948928833,
0.1890403777360916,
0.18788759410381317,
0.1865319460630417,
0.18822291493415833,
0.18859092891216278,
0.18955178558826447,
0.1866939514875412,
0.1896970570087433,
0.18807940185070038,
0.19153845310211182,
0.1898239105939865,
0.18859678506851196,
0.18917135894298553,
0.19114895164966583,
0.19347426295280457,
0.19074662029743195,
0.1910170316696167,
0.19217976927757263,
0.1939263492822647,
0.19432859122753143,
0.1944235861301422,
0.19391179084777832,
0.19482021033763885,
0.19440928101539612,
0.19418151676654816,
0.1961003690958023,
0.1958758383989334,
0.19560891389846802,
0.19733421504497528,
0.19636285305023193,
0.1954261213541031,
0.19687411189079285,
0.19881276786327362,
0.19777104258537292,
0.19909368455410004,
0.198832169175148,
0.2000124454498291,
0.19988635182380676,
0.20086662471294403,
0.20446071028709412,
0.20178112387657166,
0.20341268181800842,
0.2035277783870697,
0.20290350914001465,
0.20309564471244812,
0.20340465009212494,
0.20391499996185303,
0.20443713665008545,
0.20476184785366058,
0.20565006136894226,
0.2066260427236557,
0.20682565867900848,
0.20942071080207825,
0.2078670710325241,
0.20881949365139008,
0.20794028043746948,
0.20765909552574158,
0.20986288785934448,
0.20879799127578735,
0.20912739634513855,
0.21002855896949768,
0.21107421815395355,
0.21098566055297852,
0.2122058868408203,
0.21154867112636566,
0.21333520114421844,
0.21381357312202454,
0.21454820036888123,
0.21570594608783722,
0.21449999511241913,
0.2156064212322235,
0.2163083553314209,
0.2151729315519333,
0.2157610058784485,
0.21800461411476135,
0.2173244059085846,
0.2170359492301941,
0.21724487841129303,
0.2203254997730255,
0.217678040266037]
Lenet_val_accuracy = [0.39516666531562805,
0.4925000071525574,
0.5393333435058594,
0.6159999966621399,
0.6545000076293945,
0.6943333148956299,
0.7443333268165588,
0.799833357334137,
0.8356666564941406,
0.8538333177566528,
0.8701666593551636,
0.8774999976158142,
0.8939999938011169,
0.8978333473205566,
0.909500002861023,
0.9118333458900452,
0.9111666679382324,
0.9200000166893005,
0.9235000014305115,
0.9261666536331177,
0.9236666560173035,
0.9293333292007446,
0.9259999990463257,
0.9348333477973938,
0.9286666512489319,
0.9348333477973938,
0.9346666932106018,
0.9358333349227905,
0.9366666674613953,
0.9380000233650208,
0.9396666884422302,
0.9398333430290222,
0.9391666650772095,
0.9390000104904175,
0.940500020980835,
0.9375,
0.9398333430290222,
0.940666675567627,
0.9403333067893982,
0.940666675567627,
0.940500020980835,
0.9419999718666077,
0.9430000185966492,
0.9415000081062317,
0.9419999718666077,
0.9423333406448364,
0.9434999823570251,
0.9424999952316284,
0.9424999952316284,
0.9430000185966492,
0.9421666860580444,
0.9430000185966492,
0.9440000057220459,
0.9434999823570251,
0.9428333044052124,
0.9443333148956299,
0.9440000057220459,
0.9436666369438171,
0.9436666369438171,
0.9431666731834412,
0.9433333277702332,
0.9443333148956299,
0.9448333382606506,
0.9441666603088379,
0.9438333511352539,
0.9449999928474426,
0.9441666603088379,
0.9441666603088379,
0.9436666369438171,
0.9445000290870667,
0.9458333253860474,
0.9446666836738586,
0.9449999928474426,
0.9455000162124634,
0.9438333511352539,
0.9440000057220459,
0.9458333253860474,
0.9453333616256714,
0.9458333253860474,
0.9443333148956299,
0.9458333253860474,
0.9461666941642761,
0.9451666474342346,
0.9463333487510681,
0.9459999799728394,
0.9463333487510681,
0.9463333487510681,
0.9463333487510681,
0.9459999799728394,
0.9466666579246521,
0.9470000267028809,
0.9458333253860474,
0.9458333253860474,
0.9465000033378601,
0.9459999799728394,
0.9455000162124634,
0.9465000033378601,
0.9456666707992554,
0.9463333487510681,
0.9470000267028809,
0.9470000267028809,
0.9468333125114441,
0.9465000033378601,
0.9468333125114441,
0.9471666812896729,
0.9458333253860474,
0.9453333616256714,
0.9461666941642761,
0.9449999928474426,
0.9468333125114441,
0.9458333253860474,
0.9465000033378601,
0.9459999799728394,
0.9463333487510681,
0.9448333382606506,
0.9466666579246521,
0.9461666941642761,
0.9463333487510681,
0.9449999928474426,
0.9470000267028809]
plt.subplot(1, 2, 1)
plt.plot(Lenet_accuracy, label='Training Accuracy')
plt.plot(Lenet_val_accuracy, label='Validation Accuracy')
plt.title('Training and Validation Accuracy')
plt.legend()
plt.subplot(1, 2, 2)
plt.plot(Lenet_loss, label='Training Loss')
plt.plot(Lenet_val_loss, label='Validation Loss')
plt.title('Training and Validation Loss')
plt.legend()
plt.show()
#%%
plt.subplot(2, 1, 1)
plt.plot(Lenet_accuracy, label='Lenet_Training Accuracy')
plt.plot(DC_Lenet_accuracy, label='DC_Training Accuracy')
plt.title('Training Accuracy')
plt.legend()
plt.subplot(2, 1, 2)
plt.plot(Lenet_val_accuracy, label='Lenet_Validation Accuracy')
plt.plot(DC_Lenet_val_accuracy, label='DC_Validation Accuracy')
plt.title('Validation Accuracy')
plt.legend()