Duzduran
commited on
Commit
·
75b7d09
1
Parent(s):
7bc9401
Add model and other files
Browse files- .DS_Store +0 -0
- .gitattributes +1 -0
- .idea/.gitignore +8 -0
- .idea/NeuroNest3D.iml +8 -0
- .idea/inspectionProfiles/Project_Default.xml +27 -0
- .idea/inspectionProfiles/profiles_settings.xml +6 -0
- .idea/misc.xml +4 -0
- .idea/modules.xml +8 -0
- .idea/vcs.xml +6 -0
- logs/.DS_Store +0 -0
- logs/tensorboard/events.out.tfevents.1705017197.96cb84ca1a73.804.0.v2 +3 -0
- logs/training.log +36 -0
- loss.py +57 -0
- main.py +18 -0
- nested.h5 +3 -0
.DS_Store
ADDED
Binary file (6.15 kB). View file
|
|
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
nested.h5 filter=lfs diff=lfs merge=lfs -text
|
.idea/.gitignore
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Default ignored files
|
2 |
+
/shelf/
|
3 |
+
/workspace.xml
|
4 |
+
# Editor-based HTTP Client requests
|
5 |
+
/httpRequests/
|
6 |
+
# Datasource local storage ignored files
|
7 |
+
/dataSources/
|
8 |
+
/dataSources.local.xml
|
.idea/NeuroNest3D.iml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<module type="PYTHON_MODULE" version="4">
|
3 |
+
<component name="NewModuleRootManager">
|
4 |
+
<content url="file://$MODULE_DIR$" />
|
5 |
+
<orderEntry type="inheritedJdk" />
|
6 |
+
<orderEntry type="sourceFolder" forTests="false" />
|
7 |
+
</component>
|
8 |
+
</module>
|
.idea/inspectionProfiles/Project_Default.xml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<component name="InspectionProjectProfileManager">
|
2 |
+
<profile version="1.0">
|
3 |
+
<option name="myName" value="Project Default" />
|
4 |
+
<inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
5 |
+
<Languages>
|
6 |
+
<language minSize="89" name="Python" />
|
7 |
+
</Languages>
|
8 |
+
</inspection_tool>
|
9 |
+
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
10 |
+
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
11 |
+
<option name="ignoredErrors">
|
12 |
+
<list>
|
13 |
+
<option value="N806" />
|
14 |
+
</list>
|
15 |
+
</option>
|
16 |
+
</inspection_tool>
|
17 |
+
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
18 |
+
<option name="ignoredIdentifiers">
|
19 |
+
<list>
|
20 |
+
<option value="map.__getitem__" />
|
21 |
+
<option value="cv2.drawMarker" />
|
22 |
+
<option value="cv2.putText" />
|
23 |
+
</list>
|
24 |
+
</option>
|
25 |
+
</inspection_tool>
|
26 |
+
</profile>
|
27 |
+
</component>
|
.idea/inspectionProfiles/profiles_settings.xml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<component name="InspectionProjectProfileManager">
|
2 |
+
<settings>
|
3 |
+
<option name="USE_PROJECT_PROFILE" value="false" />
|
4 |
+
<version value="1.0" />
|
5 |
+
</settings>
|
6 |
+
</component>
|
.idea/misc.xml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (YoutubeData)" project-jdk-type="Python SDK" />
|
4 |
+
</project>
|
.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="ProjectModuleManager">
|
4 |
+
<modules>
|
5 |
+
<module fileurl="file://$PROJECT_DIR$/.idea/NeuroNest3D.iml" filepath="$PROJECT_DIR$/.idea/NeuroNest3D.iml" />
|
6 |
+
</modules>
|
7 |
+
</component>
|
8 |
+
</project>
|
.idea/vcs.xml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="VcsDirectoryMappings">
|
4 |
+
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
5 |
+
</component>
|
6 |
+
</project>
|
logs/.DS_Store
ADDED
Binary file (6.15 kB). View file
|
|
logs/tensorboard/events.out.tfevents.1705017197.96cb84ca1a73.804.0.v2
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2ffe4987ba065e9bd085909fc9b6040866d01663305e60c40e3cf5aed05ae4b6
|
3 |
+
size 52046
|
logs/training.log
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
epoch,accuracy,dice_coef,dice_coef_edema,dice_coef_enhancing,dice_coef_necrotic,loss,lr,mean_io_u,precision,sensitivity,specificity,val_accuracy,val_dice_coef,val_dice_coef_edema,val_dice_coef_enhancing,val_dice_coef_necrotic,val_loss,val_mean_io_u,val_precision,val_sensitivity,val_specificity
|
2 |
+
0,0.9798362851142883,0.26407796144485474,0.10936281830072403,0.0497506819665432,0.04571450501680374,0.16987881064414978,0.001,0.5340766310691833,0.9785353541374207,0.9694297909736633,0.9943183660507202,0.9830827116966248,0.27804192900657654,0.14084771275520325,0.04855890944600105,0.08891158550977707,0.06617364287376404,0.5966614484786987,0.9831695556640625,0.9829599261283875,0.9944087862968445
|
3 |
+
1,0.9830551147460938,0.27932676672935486,0.1592734009027481,0.060486286878585815,0.07748246192932129,0.07102330774068832,0.001,0.4987872242927551,0.9834797382354736,0.9825568199157715,0.9945077300071716,0.9830825924873352,0.2901315987110138,0.22694143652915955,0.10295352339744568,0.11394365131855011,0.06595789641141891,0.4320612847805023,0.9838308095932007,0.9827773571014404,0.9946416616439819
|
4 |
+
2,0.9830446243286133,0.2834099531173706,0.17082223296165466,0.07079077512025833,0.08092110604047775,0.07026034593582153,0.001,0.48810040950775146,0.9837684035301208,0.9819386005401611,0.9945976734161377,0.98308265209198,0.2965189218521118,0.2129736691713333,0.09708218276500702,0.11649750173091888,0.06275560706853867,0.458641916513443,0.9863182306289673,0.9796529412269592,0.9954137802124023
|
5 |
+
3,0.983135998249054,0.2933667004108429,0.20662547647953033,0.0931171327829361,0.09978671371936798,0.06638810783624649,0.001,0.6234471201896667,0.9846050143241882,0.9816950559616089,0.9948711395263672,0.9831011891365051,0.2973571717739105,0.2559315860271454,0.1134469211101532,0.13649211823940277,0.06167147681117058,0.43449386954307556,0.9836367964744568,0.9827566146850586,0.9945668578147888
|
6 |
+
4,0.9837705492973328,0.31739935278892517,0.27594155073165894,0.14274632930755615,0.14203499257564545,0.059465955942869186,0.001,0.6154603958129883,0.9865766167640686,0.9809923768043518,0.9955070614814758,0.9831899404525757,0.3100050091743469,0.3015035390853882,0.1924007534980774,0.14119958877563477,0.062064189463853836,0.43169182538986206,0.9863340258598328,0.9817227721214294,0.9954684376716614
|
7 |
+
5,0.984813392162323,0.3409692943096161,0.32928338646888733,0.2354113757610321,0.1590101569890976,0.05555671826004982,0.001,0.4413129687309265,0.9881010055541992,0.9816914796829224,0.995990514755249,0.9865278601646423,0.3882671594619751,0.4369547665119171,0.31607121229171753,0.172175332903862,0.045503050088882446,0.38246601819992065,0.9884123802185059,0.9846490621566772,0.9961042404174805
|
8 |
+
6,0.9837995767593384,0.3495938777923584,0.2933155596256256,0.283366858959198,0.18751494586467743,0.05390310660004616,0.001,0.6542459726333618,0.9877617955207825,0.981014609336853,0.9958860278129578,0.9868820309638977,0.399671733379364,0.41591066122055054,0.3987875282764435,0.22406227886676788,0.04187808185815811,0.7025570869445801,0.9907961487770081,0.9830036759376526,0.9968438148498535
|
9 |
+
7,0.9862740635871887,0.39356759190559387,0.4065650701522827,0.3888719081878662,0.22489117085933685,0.04624013230204582,0.001,0.5792930126190186,0.989669919013977,0.9829848408699036,0.9964970350265503,0.9879004955291748,0.4406234622001648,0.4834958612918854,0.4985533058643341,0.27246522903442383,0.03794711455702782,0.7921907901763916,0.9911360740661621,0.9850161671638489,0.9969798922538757
|
10 |
+
8,0.9861278533935547,0.39352118968963623,0.40322715044021606,0.38720574975013733,0.2272203415632248,0.04774325713515282,0.001,0.6675624251365662,0.9892415404319763,0.9830992817878723,0.9963651895523071,0.9880723357200623,0.42548254132270813,0.5071945190429688,0.45613181591033936,0.30733826756477356,0.03843627870082855,0.40714529156684875,0.9916272759437561,0.9842443466186523,0.9971233010292053
|
11 |
+
9,0.9878832697868347,0.44378766417503357,0.4863879084587097,0.4970869719982147,0.29434800148010254,0.03894314169883728,0.001,0.44728603959083557,0.9905421733856201,0.9850595593452454,0.9967895150184631,0.9869784116744995,0.39908817410469055,0.4700160026550293,0.39640092849731445,0.20104888081550598,0.04136401787400246,0.4647102355957031,0.9896423816680908,0.9846217036247253,0.9965198636054993
|
12 |
+
10,0.9891780614852905,0.47191086411476135,0.5417266488075256,0.55500328540802,0.34368446469306946,0.033881865441799164,0.00020000001,0.5512599945068359,0.9916951060295105,0.9862958192825317,0.9971628189086914,0.9896156191825867,0.4862504303455353,0.5461832284927368,0.5795004367828369,0.3819127678871155,0.03187418356537819,0.7194753885269165,0.9920291304588318,0.9868912696838379,0.9972818493843079
|
13 |
+
11,0.9901991486549377,0.5094708800315857,0.5964859127998352,0.601737916469574,0.4042903780937195,0.0298513974994421,0.00020000001,0.6486281156539917,0.9921148419380188,0.98777174949646,0.9973112344741821,0.9901174306869507,0.5004560351371765,0.5843119621276855,0.5789790153503418,0.3823798894882202,0.030003929510712624,0.645209789276123,0.9920229315757751,0.9878363609313965,0.9972921013832092
|
14 |
+
12,0.9905987977981567,0.5237609148025513,0.6153857111930847,0.6077953577041626,0.4347870945930481,0.027778899297118187,0.00020000001,0.7443408966064453,0.9924125671386719,0.9882500767707825,0.9974122047424316,0.990260660648346,0.5153472423553467,0.6317122578620911,0.5690821409225464,0.41225144267082214,0.02910427562892437,0.7644287943840027,0.9917133450508118,0.9881454706192017,0.997194230556488
|
15 |
+
13,0.9911732077598572,0.5380245447158813,0.6374396681785583,0.6285123229026794,0.4559764564037323,0.026087773963809013,0.00020000001,0.699303150177002,0.9927860498428345,0.9888976216316223,0.9975376725196838,0.9902002215385437,0.5208028554916382,0.5887715816497803,0.5993791818618774,0.45567676424980164,0.029071399942040443,0.7651907205581665,0.9925511479377747,0.9874908924102783,0.9974653124809265
|
16 |
+
14,0.99144047498703,0.548346757888794,0.6488054394721985,0.6324817538261414,0.48314934968948364,0.025305720046162605,0.00020000001,0.7496946454048157,0.9929893612861633,0.9891963005065918,0.9976087212562561,0.9906803369522095,0.5457987785339355,0.6554259061813354,0.5853004455566406,0.48506730794906616,0.02746163308620453,0.7188286185264587,0.9916736483573914,0.9889397621154785,0.9971938133239746
|
17 |
+
15,0.9916349053382874,0.5609546303749084,0.6631723642349243,0.6398970484733582,0.5034065842628479,0.02431631088256836,0.00020000001,0.7783783674240112,0.9929325580596924,0.9895974397659302,0.9975970387458801,0.9907163977622986,0.5439619421958923,0.6404973864555359,0.6142334342002869,0.48361942172050476,0.02778259664773941,0.7522784471511841,0.9925142526626587,0.9883626699447632,0.9974591135978699
|
18 |
+
16,0.9922199845314026,0.5744470357894897,0.6870606541633606,0.6502929925918579,0.5237146019935608,0.02251461148262024,0.00020000001,0.7879914045333862,0.9933939576148987,0.990215539932251,0.9977512359619141,0.9908708930015564,0.5560908913612366,0.5885849595069885,0.5784013271331787,0.5088785886764526,0.029265809804201126,0.8107138872146606,0.9919536709785461,0.9893292784690857,0.9972895979881287
|
19 |
+
17,0.9926502108573914,0.5888919830322266,0.7031849026679993,0.6582485437393188,0.5496827363967896,0.021116867661476135,4.0000003e-05,0.8008291125297546,0.9936126470565796,0.990813672542572,0.9978281259536743,0.9916683435440063,0.5737825632095337,0.6693967580795288,0.6166814565658569,0.5072808861732483,0.025626739487051964,0.8058607578277588,0.9925751686096191,0.9900141358375549,0.9974968433380127
|
20 |
+
18,0.9928889274597168,0.5984534025192261,0.7177655696868896,0.6656703948974609,0.5581813454627991,0.020361730828881264,4.0000003e-05,0.8068370223045349,0.9937521815299988,0.9911370277404785,0.9978767037391663,0.9916528463363647,0.5756566524505615,0.6752267479896545,0.6215696930885315,0.5207425951957703,0.025305340066552162,0.8082752823829651,0.9925832152366638,0.9899382591247559,0.9974974393844604
|
21 |
+
19,0.9930054545402527,0.601090133190155,0.7207468152046204,0.6709364652633667,0.5653109550476074,0.02004428207874298,4.0000003e-05,0.8090840578079224,0.9938521385192871,0.991240918636322,0.9979075193405151,0.991684079170227,0.577034592628479,0.678321897983551,0.6246431469917297,0.5154612064361572,0.025216132402420044,0.809943675994873,0.9925944209098816,0.9900192022323608,0.9975023865699768
|
22 |
+
20,0.9931015372276306,0.604264497756958,0.7254226803779602,0.6728044748306274,0.5754621028900146,0.01976107433438301,4.0000003e-05,0.8102717399597168,0.9939309358596802,0.9913491606712341,0.9979354739189148,0.9917191863059998,0.5781300663948059,0.6704724431037903,0.6191072463989258,0.5088266134262085,0.025989674031734467,0.8135161995887756,0.99253249168396,0.9901657104492188,0.9974822998046875
|
23 |
+
21,0.9932374954223633,0.6068506836891174,0.729882001876831,0.6770239472389221,0.5720620155334473,0.01936091110110283,8.000001e-06,0.8131572604179382,0.9940189719200134,0.9914978742599487,0.9979652166366577,0.9917663335800171,0.5813940167427063,0.6807871460914612,0.6245217323303223,0.5260345935821533,0.02511250041425228,0.8136188983917236,0.9926593899726868,0.9901058077812195,0.9975225925445557
|
24 |
+
22,0.9932612776756287,0.6085200309753418,0.7315720319747925,0.6775286197662354,0.5773301720619202,0.019247859716415405,8.000001e-06,0.8141429424285889,0.9940341114997864,0.9915295243263245,0.9979703426361084,0.9917811751365662,0.5825539231300354,0.6820725202560425,0.6247689723968506,0.5277391672134399,0.025087354704737663,0.8143664598464966,0.9926534295082092,0.9901366233825684,0.9975208640098572
|
25 |
+
23,0.9932873845100403,0.6100613474845886,0.7340559363365173,0.678149402141571,0.5775534510612488,0.019156500697135925,8.000001e-06,0.8155689239501953,0.9940265417098999,0.9915842413902283,0.9979692101478577,0.9917039275169373,0.5823221802711487,0.673153281211853,0.6260820031166077,0.5350262522697449,0.02526748925447464,0.8153451085090637,0.99269700050354,0.9900014996528625,0.9975333213806152
|
26 |
+
24,0.9933189749717712,0.6094838380813599,0.7298811078071594,0.6825781464576721,0.5806416869163513,0.019091134890913963,1.6000001e-06,0.8151898980140686,0.994130551815033,0.991544246673584,0.9980003237724304,0.9917823672294617,0.5838785171508789,0.6793622970581055,0.6255236268043518,0.5319222807884216,0.025146355852484703,0.8155220746994019,0.9926725625991821,0.9901367425918579,0.997527539730072
|
27 |
+
25,0.9933330416679382,0.6108952164649963,0.7337696552276611,0.6811770796775818,0.5821112990379333,0.019037717953324318,1.6000001e-06,0.815203070640564,0.9941011071205139,0.991597592830658,0.9979918003082275,0.991805374622345,0.5844710469245911,0.6815286874771118,0.6250231266021729,0.5299577713012695,0.025135183706879616,0.8158262968063354,0.9926527738571167,0.9901893138885498,0.9975217580795288
|
28 |
+
26,0.993338406085968,0.6115488409996033,0.7347485423088074,0.680522084236145,0.5813572406768799,0.01902145892381668,1e-06,0.815747857093811,0.9940827488899231,0.9916317462921143,0.9979871511459351,0.991807758808136,0.5846235752105713,0.6819425225257874,0.6249902248382568,0.53014075756073,0.02512160688638687,0.8159192204475403,0.9926515817642212,0.9901933670043945,0.9975212812423706
|
29 |
+
27,0.9933403134346008,0.6114413738250732,0.735161304473877,0.6804167032241821,0.5819021463394165,0.01900971122086048,1e-06,0.8155800104141235,0.9940855503082275,0.9916288256645203,0.9979879856109619,0.9918082356452942,0.5847298502922058,0.6821752786636353,0.6249317526817322,0.5303997993469238,0.025109661743044853,0.8160460591316223,0.9926519393920898,0.9901935458183289,0.9975214600563049
|
30 |
+
28,0.9933452010154724,0.6118538975715637,0.7356838583946228,0.6808207035064697,0.5819371342658997,0.019001085311174393,1e-06,0.815879762172699,0.9940834045410156,0.9916398525238037,0.9979874491691589,0.9918133616447449,0.5849103927612305,0.6823570728302002,0.624790370464325,0.5302624106407166,0.025116318836808205,0.8162018060684204,0.9926487803459167,0.9902048707008362,0.9975205659866333
|
31 |
+
29,0.9933440089225769,0.6118712425231934,0.7353044152259827,0.6806243658065796,0.5820752382278442,0.019000448286533356,1e-06,0.8159921169281006,0.994085431098938,0.9916398525238037,0.9979875683784485,0.9918167591094971,0.5850682258605957,0.6826643347740173,0.6248005628585815,0.5303140878677368,0.025111161172389984,0.816344678401947,0.9926473498344421,0.9902113080024719,0.9975200295448303
|
32 |
+
30,0.9933544993400574,0.6121431589126587,0.7359853386878967,0.6806817054748535,0.5827231407165527,0.01896785944700241,1e-06,0.8161212801933289,0.9940920472145081,0.9916515350341797,0.9979901313781738,0.991820216178894,0.5852111577987671,0.6826395392417908,0.6246011853218079,0.5301703214645386,0.025123735889792442,0.8165305256843567,0.9926450848579407,0.9902201294898987,0.9975191950798035
|
33 |
+
31,0.9933506846427917,0.6123300790786743,0.7363465428352356,0.6802732348442078,0.5823085308074951,0.01897674798965454,1e-06,0.8163615465164185,0.9940773844718933,0.9916576147079468,0.99798583984375,0.991815984249115,0.5852704644203186,0.6822807192802429,0.6249029636383057,0.5311571359634399,0.02511741779744625,0.816642165184021,0.9926512241363525,0.9902098178863525,0.9975214004516602
|
34 |
+
32,0.993353009223938,0.6124129891395569,0.7361547350883484,0.6806544065475464,0.5826413631439209,0.018972571939229965,1e-06,0.8163591623306274,0.9940841197967529,0.9916569590568542,0.9979878664016724,0.9918175339698792,0.5853288173675537,0.682660698890686,0.62476646900177,0.5308569669723511,0.02510947920382023,0.816709578037262,0.9926489591598511,0.990214467048645,0.9975205659866333
|
35 |
+
33,0.9933574199676514,0.612567663192749,0.7360206842422485,0.6804376244544983,0.5830256342887878,0.018954306840896606,1e-06,0.8166317343711853,0.9940869212150574,0.99166339635849,0.9979889392852783,0.9918233752250671,0.5855512022972107,0.682876706123352,0.6247772574424744,0.5309704542160034,0.02511085942387581,0.8169111013412476,0.992647111415863,0.9902239441871643,0.9975196123123169
|
36 |
+
34,0.9933577179908752,0.6124356985092163,0.7365803122520447,0.6804555058479309,0.5833529233932495,0.018955830484628677,1e-06,0.8164645433425903,0.9940868020057678,0.9916606545448303,0.9979889988899231,0.9918227791786194,0.585665762424469,0.6826246380805969,0.6247537732124329,0.5306872725486755,0.025132223963737488,0.817170262336731,0.9926446676254272,0.9902293086051941,0.9975196123123169
|
loss.py
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import keras.backend as K
|
2 |
+
|
3 |
+
# dice loss as defined above for 4 classes
|
4 |
+
def dice_coef(y_true, y_pred, smooth=1.0):
|
5 |
+
class_num = 4
|
6 |
+
for i in range(class_num):
|
7 |
+
y_true_f = K.flatten(y_true[:,:,:,i])
|
8 |
+
y_pred_f = K.flatten(y_pred[:,:,:,i])
|
9 |
+
intersection = K.sum(y_true_f * y_pred_f)
|
10 |
+
loss = ((2. * intersection + smooth) / (K.sum(y_true_f) + K.sum(y_pred_f) + smooth))
|
11 |
+
# K.print_tensor(loss, message='loss value for class {} : '.format(SEGMENT_CLASSES[i]))
|
12 |
+
if i == 0:
|
13 |
+
total_loss = loss
|
14 |
+
else:
|
15 |
+
total_loss = total_loss + loss
|
16 |
+
total_loss = total_loss / class_num
|
17 |
+
# K.print_tensor(total_loss, message=' total dice coef: ')
|
18 |
+
return total_loss
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
+
# define per class evaluation of dice coef
|
23 |
+
# inspired by https://github.com/keras-team/keras/issues/9395
|
24 |
+
def dice_coef_necrotic(y_true, y_pred, epsilon=1e-6):
|
25 |
+
intersection = K.sum(K.abs(y_true[:,:,:,1] * y_pred[:,:,:,1]))
|
26 |
+
return (2. * intersection) / (K.sum(K.square(y_true[:,:,:,1])) + K.sum(K.square(y_pred[:,:,:,1])) + epsilon)
|
27 |
+
|
28 |
+
def dice_coef_edema(y_true, y_pred, epsilon=1e-6):
|
29 |
+
intersection = K.sum(K.abs(y_true[:,:,:,2] * y_pred[:,:,:,2]))
|
30 |
+
return (2. * intersection) / (K.sum(K.square(y_true[:,:,:,2])) + K.sum(K.square(y_pred[:,:,:,2])) + epsilon)
|
31 |
+
|
32 |
+
def dice_coef_enhancing(y_true, y_pred, epsilon=1e-6):
|
33 |
+
intersection = K.sum(K.abs(y_true[:,:,:,3] * y_pred[:,:,:,3]))
|
34 |
+
return (2. * intersection) / (K.sum(K.square(y_true[:,:,:,3])) + K.sum(K.square(y_pred[:,:,:,3])) + epsilon)
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
# Computing Precision
|
39 |
+
def precision(y_true, y_pred):
|
40 |
+
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
|
41 |
+
predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1)))
|
42 |
+
precision = true_positives / (predicted_positives + K.epsilon())
|
43 |
+
return precision
|
44 |
+
|
45 |
+
|
46 |
+
# Computing Sensitivity
|
47 |
+
def sensitivity(y_true, y_pred):
|
48 |
+
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
|
49 |
+
possible_positives = K.sum(K.round(K.clip(y_true, 0, 1)))
|
50 |
+
return true_positives / (possible_positives + K.epsilon())
|
51 |
+
|
52 |
+
|
53 |
+
# Computing Specificity
|
54 |
+
def specificity(y_true, y_pred):
|
55 |
+
true_negatives = K.sum(K.round(K.clip((1-y_true) * (1-y_pred), 0, 1)))
|
56 |
+
possible_negatives = K.sum(K.round(K.clip(1-y_true, 0, 1)))
|
57 |
+
return true_negatives / (possible_negatives + K.epsilon())
|
main.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from huggingface_hub import push_to_hub_keras
|
2 |
+
from loss import *
|
3 |
+
import keras
|
4 |
+
import tensorflow as tf
|
5 |
+
|
6 |
+
# Load the model
|
7 |
+
model = keras.models.load_model('nested.h5',
|
8 |
+
custom_objects={'accuracy': tf.keras.metrics.MeanIoU(num_classes=4),
|
9 |
+
"dice_coef": dice_coef,
|
10 |
+
"precision": precision,
|
11 |
+
"sensitivity": sensitivity,
|
12 |
+
"specificity": specificity,
|
13 |
+
"dice_coef_necrotic": dice_coef_necrotic,
|
14 |
+
"dice_coef_edema": dice_coef_edema,
|
15 |
+
"dice_coef_enhancing": dice_coef_enhancing
|
16 |
+
},
|
17 |
+
compile=False
|
18 |
+
)
|
nested.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c38c136bca9526cdd79268fbf8291d260fcb40238cd3424c8e3b290aa3e94243
|
3 |
+
size 93325760
|