Skip to content

Commit

Permalink
Merge pull request #197 from Insiyaa/feature_segment
Browse files Browse the repository at this point in the history
Patchwise prediction and some fixes
  • Loading branch information
birm authored Aug 12, 2019
2 parents 51eaf4b + 112dc58 commit 1137e93
Show file tree
Hide file tree
Showing 16 changed files with 1,062 additions and 304 deletions.
25 changes: 25 additions & 0 deletions apps/model/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Prediction
> Allows testing classification models

## Example usage

![toolbar button](assets/toolbar.png)


Clicking the plus icon will allow adding a Keras/tensorflowjs trained model.

Select the desired model from the dropdow.

Next, zoom in to an area that you would like to predict and select the required area.

![Predictions](assets/prediction.png)

The result box shows the class with maximum average probability taken across all the patches. Clicking the Save as CSV button will save the probabilities of all the classes along with the patch coordinate from the top left corner as a .csv [file](assets/eg.csv).







227 changes: 227 additions & 0 deletions apps/model/assets/eg.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
1Malignant,2Benign,x,y
0.9985954165458679,0.001404520939104259,0,0
0.9205408096313477,0.07945913076400757,48,0
0.9997959733009338,0.00020415046310517937,96,0
0.9704725742340088,0.029527487233281136,144,0
0.8215681910514832,0.17843179404735565,192,0
0.9985968470573425,0.00140309554990381,240,0
0.5049904584884644,0.49500954151153564,288,0
0.9998550415039062,0.00014497940719593316,336,0
0.9593886137008667,0.040611449629068375,384,0
0.9918960928916931,0.00810406357049942,432,0
0.9996910691261292,0.0003089885285589844,480,0
0.9214723110198975,0.07852774113416672,528,0
0.2374163717031479,0.7625836730003357,576,0
0.07835043966770172,0.9216495752334595,624,0
0.03925777226686478,0.960742175579071,672,0
0.5763614773750305,0.4236384928226471,0,48
0.2515996992588043,0.7484003305435181,48,48
0.9997358322143555,0.00026396839530207217,96,48
0.9662612676620483,0.033738717436790466,144,48
0.9012744426727295,0.09872554987668991,192,48
0.9396805763244629,0.06031951308250427,240,48
0.8605049848556519,0.13949503004550934,288,48
0.9981753826141357,0.0018246319377794862,336,48
0.9866987466812134,0.013301336206495762,384,48
0.9872606992721558,0.012739314697682858,432,48
0.9999923706054688,0.00000785518204793334,480,48
0.9984948039054871,0.001505285850726068,528,48
0.1547650545835495,0.8452348709106445,576,48
0.12220651656389236,0.877793550491333,624,48
0.0410650372505188,0.958935022354126,672,48
0.9995564222335815,0.0004436174640432,0,96
0.9996717572212219,0.00032814074074849486,48,96
0.9989041686058044,0.0010958799393847585,96,96
0.9998233318328857,0.00017670393572188914,144,96
0.9997449517250061,0.000254981336183846,192,96
0.9991934895515442,0.0008063483983278275,240,96
0.9947522878646851,0.005247656721621752,288,96
0.8979324698448181,0.10206752270460129,336,96
0.9999995827674866,3.478810413071187e-7,384,96
0.9735645055770874,0.026435470208525658,432,96
0.9999828934669495,0.0000172339550772449,480,96
0.9401842355728149,0.05981587618589401,528,96
0.6634129881858826,0.33658698201179504,576,96
0.12798455357551575,0.8720154762268066,624,96
0.17836996912956238,0.8216301202774048,672,96
0.8476992845535278,0.15230076014995575,0,144
0.9282453656196594,0.07175467163324356,48,144
0.8986295461654663,0.10137058794498444,96,144
0.9921927452087402,0.007807334419339895,144,144
0.48178887367248535,0.5182111263275146,192,144
0.8489846587181091,0.15101541578769684,240,144
0.8251461386680603,0.17485399544239044,288,144
0.9969529509544373,0.0030471414793282747,336,144
0.9475741386413574,0.05242588743567467,384,144
0.9959613084793091,0.004038820043206215,432,144
0.9996715188026428,0.000328540540067479,480,144
0.08949819952249527,0.9105018973350525,528,144
0.3875957727432251,0.6124042272567749,576,144
0.2539704144001007,0.7460294961929321,624,144
0.06434562057256699,0.9356544613838196,672,144
0.996811032295227,0.0031890557147562504,0,192
0.9866592884063721,0.013340825214982033,48,192
0.9800156354904175,0.019984474405646324,96,192
0.9976972937583923,0.002302742563188076,144,192
0.05291193351149559,0.9470880031585693,192,192
0.5806440711021423,0.4193558990955353,240,192
0.9999966621398926,0.0000032126629321282962,288,192
0.9482116103172302,0.051788341253995895,336,192
0.9997656345367432,0.00023440762015525252,384,192
0.9999990463256836,7.134869406399957e-7,432,192
0.996881365776062,0.003118557622656226,480,192
0.11401917785406113,0.8859808444976807,528,192
0.09863995015621185,0.901360034942627,576,192
0.013047336600720882,0.9869527220726013,624,192
0.019334089010953903,0.9806658625602722,672,192
0.3565789461135864,0.6434209942817688,0,240
0.03629346564412117,0.9637066125869751,48,240
0.9986876845359802,0.0013123538810759783,96,240
0.6798233985900879,0.3201766014099121,144,240
0.9889292120933533,0.011070779524743557,192,240
0.7550020813941956,0.24499796330928802,240,240
0.9681113958358765,0.031888701021671295,288,240
0.9999945163726807,0.000005496232461155159,336,240
0.8694819211959839,0.13051815330982208,384,240
0.9999504089355469,0.00004981473466614261,432,240
0.8375047445297241,0.16249532997608185,480,240
0.06275255978107452,0.9372474551200867,528,240
0.05388300120830536,0.9461170434951782,576,240
0.0466044656932354,0.9533956050872803,624,240
0.02710416167974472,0.9728958010673523,672,240
0.9993801116943359,0.0006199352792464197,0,288
0.9980464577674866,0.0019537073094397783,48,288
0.9999880790710449,0.000012133019481552765,96,288
0.9811093807220459,0.018890555948019028,144,288
0.9996176362037659,0.00038236493128351867,192,288
0.9931614995002747,0.00683854753151536,240,288
0.9938629865646362,0.006137088406831026,288,288
0.9999690055847168,0.00003098254819633439,336,288
0.9999761581420898,0.00002395408046140801,384,288
0.9999604821205139,0.00003969842509832233,432,288
0.10136943310499191,0.8986304998397827,480,288
0.1020389050245285,0.8979611396789551,528,288
0.43275177478790283,0.5672481656074524,576,288
0.3174363374710083,0.6825637221336365,624,288
0.017171943560242653,0.9828280806541443,672,288
0.9982843995094299,0.0017155820969492197,0,336
0.9832608699798584,0.016739238053560257,48,336
0.7081504464149475,0.2918495535850525,96,336
0.9138469696044922,0.08615314960479736,144,336
0.9953201413154602,0.004679850768297911,192,336
0.9822869300842285,0.017713041976094246,240,336
0.9999904632568359,0.000009367049642605707,288,336
0.9991390109062195,0.0008610633667558432,336,336
0.6402695775032043,0.35973045229911804,384,336
0.9999809861183167,0.000018997910956386477,432,336
0.13649876415729523,0.8635011911392212,480,336
0.08050098270177841,0.9194990396499634,528,336
0.020960960537195206,0.9790390133857727,576,336
0.1983315348625183,0.8016684651374817,624,336
0.015562260523438454,0.9844377636909485,672,336
0.9955949783325195,0.004405023995786905,0,384
0.9992849826812744,0.0007150312303565443,48,384
0.962296187877655,0.03770383074879646,96,384
0.9999527931213379,0.00004748353603645228,144,384
0.9999005794525146,0.00009939371375367045,192,384
0.990642786026001,0.009357282891869545,240,384
0.9962684512138367,0.0037315492518246174,288,384
0.9999818801879883,0.00001813335438782815,336,384
0.9999799728393555,0.00001988706389965955,384,384
0.8973366022109985,0.10266352444887161,432,384
0.06493907421827316,0.935060977935791,480,384
0.024415908381342888,0.9755842089653015,528,384
0.03618552163243294,0.9638144373893738,576,384
0.04396817088127136,0.956031858921051,624,384
0.0579143688082695,0.9420856833457947,672,384
0.9991108775138855,0.0008891930337995291,0,432
0.993759274482727,0.006240730173885822,48,432
0.9965644478797913,0.003435517195612192,96,432
0.9995448589324951,0.0004551125457510352,144,432
0.7553902268409729,0.2446097731590271,192,432
0.9998877048492432,0.00011237907165195793,240,432
0.955131471157074,0.04486849904060364,288,432
0.9982458353042603,0.001754112890921533,336,432
0.9999887943267822,0.000011204883776372299,384,432
0.18184787034988403,0.8181521892547607,432,432
0.4493001401424408,0.5506998896598816,480,432
0.03674199804663658,0.9632580876350403,528,432
0.21828119456768036,0.7817187905311584,576,432
0.04551190882921219,0.9544880986213684,624,432
0.07864239066839218,0.9213576316833496,672,432
0.9408959746360779,0.05910402536392212,0,480
0.4817791283130646,0.5182209014892578,48,480
0.49879905581474304,0.5012009143829346,96,480
0.8632409572601318,0.13675910234451294,144,480
0.9999895691871643,0.000010535763976804446,192,480
0.9986640810966492,0.0013358854921534657,240,480
0.757814347743988,0.24218568205833435,288,480
0.9360302686691284,0.06396979093551636,336,480
0.9984817504882812,0.0015183084178715944,384,480
0.5454346537590027,0.4545653760433197,432,480
0.05935801565647125,0.9406419992446899,480,480
0.058516234159469604,0.941483736038208,528,480
0.07010966539382935,0.9298904538154602,576,480
0.06913848966360092,0.9308614730834961,624,480
0.026484567672014236,0.9735154509544373,672,480
0.9998877048492432,0.00011239259038120508,0,528
0.998605489730835,0.001394423539750278,48,528
0.16237735748291016,0.8376227021217346,96,528
0.9999837875366211,0.000016497369870194234,144,528
0.9881188869476318,0.011881185695528984,192,528
0.03197098523378372,0.9680290818214417,240,528
0.8062790632247925,0.19372105598449707,288,528
0.9996629953384399,0.00033696842729113996,336,528
0.9126400947570801,0.0873599573969841,384,528
0.09281328320503235,0.9071868062019348,432,528
0.020917097106575966,0.9790828824043274,480,528
0.03489212319254875,0.9651079773902893,528,528
0.25631746649742126,0.7436825633049011,576,528
0.05989621579647064,0.9401038289070129,624,528
0.5046761631965637,0.49532386660575867,672,528
0.29442718625068665,0.705572783946991,0,576
0.19126611948013306,0.8087339401245117,48,576
0.9978089928627014,0.0021910443902015686,96,576
0.9997871518135071,0.0002129045024048537,144,576
0.998765766620636,0.0012341621331870556,192,576
0.999977171421051,0.00002308856346644461,240,576
0.9999816417694092,0.000018330729290028103,288,576
0.9978402256965637,0.0021597836166620255,336,576
0.5087238550186157,0.4912761151790619,384,576
0.10152903944253922,0.898470938205719,432,576
0.08620612323284149,0.9137940406799316,480,576
0.031105464324355125,0.9688946008682251,528,576
0.040245283395051956,0.9597547650337219,576,576
0.14771738648414612,0.852282702922821,624,576
0.7329567074775696,0.2670433521270752,672,576
0.9999158382415771,0.00008427429565927014,0,624
0.9620344638824463,0.037965573370456696,48,624
0.05419553071260452,0.9458044171333313,96,624
0.9789519906044006,0.021047893911600113,144,624
0.9912523031234741,0.008747727610170841,192,624
0.9983189105987549,0.0016811005771160126,240,624
0.9999985694885254,0.000001573395593368332,288,624
0.3414357006549835,0.6585642695426941,336,624
0.04133325070142746,0.9586667418479919,384,624
0.0233718603849411,0.9766281843185425,432,624
0.027237368747591972,0.9727627038955688,480,624
0.014209930785000324,0.9857900738716125,528,624
0.2371993511915207,0.7628006935119629,576,624
0.7349754571914673,0.2650246024131775,624,624
0.32195478677749634,0.6780453324317932,672,624
0.9987415671348572,0.0012584393844008446,0,672
0.2987009584903717,0.7012991309165955,48,672
0.8811144232749939,0.11888565868139267,96,672
0.5605188012123108,0.43948110938072205,144,672
0.9999074935913086,0.00009270620648749173,192,672
0.9989063143730164,0.0010937877232208848,240,672
0.9980427622795105,0.0019572789315134287,288,672
0.04269136115908623,0.9573085904121399,336,672
0.9892861843109131,0.010713827796280384,384,672
0.08427723497152328,0.9157229065895081,432,672
0.0270188320428133,0.9729812741279602,480,672
0.019236069172620773,0.9807640314102173,528,672
0.07720037549734116,0.9227997064590454,576,672
0.09384951740503311,0.9061504602432251,624,672
0.9325267672538757,0.06747337430715561,672,672

Expand Down
Binary file added apps/model/assets/prediction.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/model/assets/toolbar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1137e93

Please sign in to comment.