Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
hieu.phan committed Mar 31, 2024
1 parent 202e635 commit f4ee417
Show file tree
Hide file tree
Showing 14 changed files with 147 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Dataset,Accuracy,Max F1,AUC ROC,Precision,Recall
padchest_feature_seen,0.9256268632148802,0.2847841559446861,0.7879288387898779,0.25840316861057516,0.4008569226665974
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Dataset,Accuracy,Max F1,AUC ROC,Precision,Recall
chexpert_feature,0.8644000000000001,0.6546495281761112,0.9012926419579443,0.6356204786356054,0.6995904943505792
chexray_text,0.7581067354274105,0.2558256212223197,0.7116356729284974,0.21064218896333986,0.4782386539647661
covid-cxr2_feature,0.7507578309195015,0.8021419009370816,0.7873682775624384,0.6970684039087948,0.9445145018915511
rsna_feature,0.8128161888701517,0.6259370314842578,0.8631169146464122,0.5758620689655173,0.6855500821018062
padchest_text_rare,0.8366767444990464,0.05618539142955089,0.6972462102333754,0.02528194648328482,nan
padchest_feature_seen,0.9220878980192768,0.2802851961540454,0.7794547344991044,0.27071407850028917,0.4137235313505583
padchest_text_unseen,0.8399543378995434,0.05696926439197684,0.7041645952368335,0.028870994911606364,nan
covid-cxr2_text,0.7807342539575615,0.8173130972456437,0.8386366516856186,0.7373225152129818,0.9167717528373266
padchest_feature_rare,0.8574495533911741,0.051494438020417754,0.6990948538270612,0.027845720803903556,nan
padchest_feature_unseen,0.8022532326206632,0.05470119231770515,0.6784093235898107,0.033699702006010586,nan
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Dataset,Accuracy,Max F1,AUC ROC,Precision,Recall
chexpert_feature,0.8644000000000001,0.6880837157748669,0.913347059302313,0.6160056996662853,0.787180836229773
chexray_text,0.7484400464358272,0.2625998222993849,0.7164087576472008,0.22424321949764606,0.4968634518396521
covid-cxr2_feature,0.7558100370495117,0.8056897477187331,0.8026919384090182,0.7014018691588785,0.9464060529634301
rsna_feature,0.8242458309911935,0.6341272940257712,0.8691215684773712,0.6046165301563663,0.6666666666666666
padchest_text_rare,0.846416460678399,0.053738945202462765,0.7006070407500374,0.026750795490862175,nan
padchest_feature_seen,0.9130621650785523,0.28195177215062384,0.7839458113395431,0.3078537342411968,0.46447918552750106
padchest_text_unseen,0.8219178082191781,0.05687716647802562,0.7063434850962458,0.031597490640546386,nan
covid-cxr2_text,0.7766924890535534,0.8173289183222959,0.8404434043724966,0.7266928361138371,0.9337957124842371
padchest_feature_rare,0.8293662126718073,0.0521084530857862,0.6719508693333492,0.030288090630520712,nan
padchest_feature_unseen,0.8199419621900739,0.05810438317332132,0.6715724313716058,0.05316258924502213,nan
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Class Name,Accuracy,Max F1,AUC ROC,Precision,Recall
cardiomegaly,0.83,0.7558139534883721,0.9061272509914798,0.6735751295336787,0.8609271523178808
edema,0.868,0.6632124352331606,0.927451695224207,0.5565217391304348,0.8205128205128205
consolidation,0.938,0.5161290322580646,0.9092905776411158,0.48484848484848486,0.5517241379310345
atelectasis,0.774,0.7052631578947367,0.8697330997720895,0.5903083700440529,0.8758169934640523
effusion,0.912,0.8,0.9541326728826729,0.7747747747747747,0.8269230769230769
Average,0.8644000000000001,0.6880837157748669,0.913347059302313,0.6160056996662853,0.787180836229773
16 changes: 16 additions & 0 deletions Zero-shot_classification/results/result_mavl_chexray_feature.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Class Name,Accuracy,Max F1,AUC ROC,Precision,Recall
atelectasis,0.620604781997187,0.3210739756677388,0.7023110659933828,0.20829175360609634,0.7002134797194266
cardiomegaly,0.9422956711986248,0.2978116079923882,0.8345913094837584,0.30300096805421106,0.29279700654817586
effusion,0.8057899671823723,0.5372439478584731,0.8237908462782082,0.47435054258467607,0.6193645341348218
infiltrate,0.6392014377246444,0.48949579831932777,0.7136797780982327,0.36965597862391447,0.7243128272251309
mass,0.8511876855758712,0.24324324324324326,0.7260142443906757,0.18635809987819732,0.3501144164759725
nodule,0.7228473198937334,0.1685617160942445,0.632956543661424,0.1040822235089751,0.4430067775723968
pneumonia,0.8616971401781528,0.10109220218440436,0.7320434847210935,0.05884092253104672,0.35855855855855856
pneumothorax,0.8774417877793406,0.5131946600434648,0.8649977995001401,0.43764892772041303,0.6202626641651032
consolidation,0.698155961869042,0.22119165238431296,0.7221225871569347,0.13536525172754196,0.6044077134986225
edema,0.8357555868104392,0.19467330906303892,0.8092150867579508,0.11830461108523521,0.5491891891891892
emphysema,0.9388185654008439,0.269715352309846,0.7365287795108756,0.2752380952380952,0.2644098810612992
tail_abnorm_obs,0.9107673073917799,0.07757575757575758,0.622269458252075,0.047058823529411764,0.2206896551724138
thicken,0.8900218784185029,0.12987012987012986,0.6079903350935261,0.10043041606886657,0.1837270341207349
hernia,0.9930067197999688,0.11,0.7718202164221966,0.09649122807017543,0.12790697674418605
Average,0.8276851293728932,0.26248166804331213,0.7357379668086053,0.20822270301620402,0.4327829081561451
16 changes: 16 additions & 0 deletions Zero-shot_classification/results/result_mavl_chexray_text.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Class Name,Accuracy,Max F1,AUC ROC,Precision,Recall
atelectasis,0.6234958587279262,0.30865260439087383,0.6827122669481632,0.20180129468055163,0.6559926806953339
cardiomegaly,0.8854508516955775,0.19189412737799835,0.7437324850340568,0.13604378420641125,0.3255378858746492
effusion,0.7005000781372089,0.47568233121280523,0.7813312205439511,0.34906133922296956,0.7464577071704595
infiltrate,0.6496327551179872,0.4742304309586632,0.6968721684378429,0.369551311340583,0.6616492146596858
mass,0.8929129551492421,0.25985953538627765,0.7269158714574455,0.24616171954964175,0.2751716247139588
nodule,0.8463041100171902,0.18487046632124352,0.6500124691006486,0.13928794503435352,0.27479975354282193
pneumonia,0.8909595249257697,0.10805626598465475,0.7339993761582356,0.06568208317139526,0.3045045045045045
pneumothorax,0.8697062040943897,0.47263524201202156,0.8379677494020522,0.4085315832649713,0.5606003752345216
consolidation,0.7151117362087827,0.22458528285835813,0.722603212532912,0.13914876795361708,0.5818181818181818
edema,0.9038130957962182,0.19811013359400456,0.8105808658157571,0.1417910447761194,0.3286486486486486
emphysema,0.9347944991404907,0.3032581453634085,0.7966375011906416,0.27901614142966946,0.3321134492223239
tail_abnorm_obs,0.11935458665416471,0.03518534372057187,0.4898736276311588,0.017926462249749205,0.9448275862068966
thicken,0.44928895139865604,0.10604426967717384,0.5964592242393044,0.057166301969365424,0.731408573928259
hernia,0.9968354430379747,0.3333333333333333,0.7600245685686415,0.5882352941176471,0.23255813953488372
Average,0.7484400464358272,0.2625998222993849,0.7164087576472008,0.22424321949764606,0.4968634518396521
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Class Name,Accuracy,Max F1,AUC ROC,Precision,Recall
covid19,0.7558100370495117,0.8056897477187331,0.8026919384090182,0.7014018691588785,0.9464060529634301
Average,0.7558100370495117,0.8056897477187331,0.8026919384090182,0.7014018691588785,0.9464060529634301
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Class Name,Accuracy,Max F1,AUC ROC,Precision,Recall
covid19,0.7766924890535534,0.8173289183222959,0.8404434043724966,0.7266928361138371,0.9337957124842371
Average,0.7766924890535534,0.8173289183222959,0.8404434043724966,0.7266928361138371,0.9337957124842371
16 changes: 16 additions & 0 deletions Zero-shot_classification/results/result_mavl_padchest_feature.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Class Name,Accuracy,Max F1,AUC ROC,Precision,Recall
normal,0.6434515426961976,0.6184408823126456,0.7643992505853414,0.4787865931268562,0.8731141199226305
effusion,0.9711944693381129,0.6715542521994136,0.9627576464030613,0.6580459770114943,0.6856287425149701
pacemaker,0.9924465497375496,0.8457446808510638,0.9957998386369936,0.7681159420289855,0.9408284023668639
atelectasis,0.967609781077967,0.14864864864864866,0.7826873428302373,0.14864864864864866,0.14864864864864866
pneumonia,0.9490462168736398,0.38258164852255055,0.835556925651499,0.44404332129963897,0.3360655737704918
consolidation,0.9761874279861733,0.21940928270042193,0.9106692069540366,0.16149068322981366,0.34210526315789475
cardiomegaly,0.8978363845858405,0.5379710144927535,0.913037807230802,0.4793388429752066,0.6129458388375165
emphysema,0.9737549609525029,0.09734513274336284,0.8149829148181649,0.07142857142857142,0.1527777777777778
nodule,0.9494302906157982,0.07511737089201878,0.6200792195074094,0.05776173285198556,0.10738255033557047
edema,0.9959032134169761,0.24390243902439027,0.9702694034637589,0.2,0.3125
pneumothorax,0.9959032134169761,0.1142857142857143,0.8223591323321781,0.13333333333333333,0.1
fracture,0.8107796696965818,0.0013522650439486141,0.44420252732240434,0.0006775067750677507,0.3333333333333333
mass,0.8439380361029317,0.001639344262295082,0.508452868852459,0.0008216926869350862,0.3333333333333333
catheter,0.9912943285110741,0.028985507246376812,0.6857496584699454,0.015151515151515152,0.3333333333333333
Average,0.9256268632148802,0.2847841559446861,0.7879288387898779,0.25840316861057516,0.4008569226665974
51 changes: 51 additions & 0 deletions Zero-shot_classification/results/result_mavl_padchest_text.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Class Name,Accuracy,Max F1,AUC ROC,Precision,Recall
major fissure thickening,0.9617206503648701,0.01973684210526316,0.7692074592074593,0.010238907849829351,0.2727272727272727
calcified granuloma,0.7075918576366662,0.053874844591794445,0.6210029369622134,0.028583992963940194,0.4676258992805755
volume loss,0.9108948918192293,0.1596130592503023,0.8244434885471557,0.09792284866468842,0.43137254901960786
flattened diaphragm,0.4693381129176802,0.018474656560871622,0.6011976955730747,0.009350275713258211,0.7647058823529411
sclerotic bone lesion,0.7075918576366662,0.011260285838025118,0.5559246883434006,0.005704256252742431,0.43333333333333335
axial hyperostosis,0.4567917040071694,0.014862981885740827,0.6830469051291939,0.007487131492746842,1.0
round atelectasis,1.0,nan,0.5909082258003121,0.0,nan
hypoexpansion basal,0.4011010113941877,0.00973957230573788,0.35191174586909185,0.0048977853492333905,0.8518518518518519
abnormal foreign body,0.3048265266931251,0.0011037527593818985,0.49891151235753617,0.0005522827687776141,0.75
cervical rib,0.6754576878760722,0.0007886435331230285,0.7153472734295446,0.0003946329913180742,0.5
supra aortic elongation,0.967865830239406,0.03846153846153846,0.5758577392723734,0.023148148148148147,0.11363636363636363
esophagic dilatation,1.0,nan,0.8308072457378013,0.0,nan
pleural mass,1.0,nan,0.7258805122590064,0.0,nan
osteosynthesis material,0.35347586736653436,0.0140597539543058,0.6100414930174746,0.007086614173228346,0.8780487804878049
bullas,0.9628728715913455,0.05863192182410423,0.9473094115873084,0.03308823529411765,0.2571428571428571
aortic button enlargement,0.9910382793496352,0.0547945205479452,0.7024153730389429,0.08,0.041666666666666664
apical pleural thickening,0.6737933683267188,0.09904492394764766,0.9678491168931493,0.055205047318611984,0.48109965635738833
dual chamber device,0.9544232492638587,0.13202933985330073,0.6962151942879169,0.07584269662921349,0.5094339622641509
breast mass,1.0,nan,0.6461394325794546,0.0,nan
pulmonary artery hypertension,1.0,nan,0.6677336747759284,0.0,nan
empyema,1.0,nan,0.8748879498015111,0.0,nan
callus rib fracture,0.8826014594802202,0.08216432865731463,0.6482939192961301,0.04846335697399527,0.26973684210526316
central venous catheter via jugular vein,0.9914223530917936,0.25,0.9973111395646607,0.25,0.25
mediastinic lipomatosis,0.8499551913967481,0.016792611251049538,0.7347503226035588,0.008598452278589854,0.35714285714285715
calcified densities,0.9726027397260274,0.03619909502262443,0.6622352564735997,0.024691358024691357,0.06779661016949153
aortic endoprosthesis,0.6676481884521828,0.0007701193685021179,0.4636363636363636,0.0003852080123266564,1.0
pleural plaques,0.9279221610549225,0.0035460992907801413,0.9700486805021779,0.0017793594306049821,0.5
ground glass pattern,0.9920624759953911,0.03174603174603175,0.6856865146812917,0.025,0.043478260869565216
total atelectasis,0.9971834592241711,0.08695652173913045,0.6823857474961416,0.045454545454545456,1.0
suture material,0.8600691332735886,0.09,0.6813847863024441,0.05056179775280899,0.4090909090909091
COPD signs,0.5745743182691077,0.29010895107882934,0.693854033290653,0.18082556591211718,0.7332613390928726
nephrostomy tube,1.0,nan,0.9475426915431227,0.0,nan
right sided aortic arch,0.4635770067853028,0.0004772130756382725,0.9011909613730018,0.00023866348448687351,1.0
mediastinal shift,0.9841249519907822,0.061068702290076333,0.9022627144018136,0.031746031746031744,0.8
aortic elongation,0.6415311739854052,0.2179379715004191,0.5544363213974817,0.13113651647612642,0.6446280991735537
sternotomy,0.9283062347970811,0.09400324149108591,0.47439180537772085,0.06196581196581197,0.19463087248322147
vertebral anterior compression,0.8922033030341826,0.09081081081081081,0.9912932138284251,0.054901960784313725,0.2625
ventriculoperitoneal drain tube,0.6937652029189605,0.0008357709987463434,0.5000853825136612,0.0004180602006688963,1.0
single chamber device,0.9496863397772373,0.125,0.07298335467349548,0.0691358024691358,0.6511627906976745
central venous catheter,0.99487901677122,0.0930232558139535,0.7212071155873665,0.07692307692307693,0.11764705882352941
multiple nodules,0.9964153117398541,0.12903225806451615,0.7512342790719144,0.15384615384615385,0.1111111111111111
diaphragmatic eventration,0.33440020483932914,0.03166915052160953,0.7615877080665813,0.016129032258064516,0.8673469387755102
sternoclavicular junction hypertrophy,1.0,nan,0.773370959466393,0.0,nan
cyst,0.4743310715657406,0.0004869734599464329,0.9359795134443022,0.00024354603019970775,1.0
azygoesophageal recess shift,1.0,nan,0.9018945015482145,0.0,nan
respiratory distress,0.9911663039303547,0.02857142857142857,0.7424432765030125,0.014492753623188406,1.0
calcified mediastinal adenopathy,0.38471386506209193,0.0012471419663271667,0.6272154976764293,0.0006239600665557404,1.0
external foreign body,0.07297401101011394,0.00027616680475006904,0.7757476575535874,0.00013810247203424942,1.0
metal,0.9737549609525029,0.08928571428571429,0.5993379773726595,0.06896551724137931,0.12658227848101267
Average,0.8219178082191781,0.05687716647802562,0.7063434850962458,0.031597490640546386,nan
3 changes: 3 additions & 0 deletions Zero-shot_classification/results/result_mavl_rsna_feature.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Class Name,Accuracy,Max F1,AUC ROC,Precision,Recall
pneumonia,0.8242458309911935,0.6341272940257712,0.8691215684773712,0.6046165301563663,0.6666666666666666
Average,0.8242458309911935,0.6341272940257712,0.8691215684773712,0.6046165301563663,0.6666666666666666
3 changes: 3 additions & 0 deletions Zero-shot_classification/results/result_mavl_siim_feature.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Class Name,Accuracy,Max F1,AUC ROC,Precision,Recall
pneumothorax,0.8869227449287872,0.7952941176470589,0.9287952688132236,0.8073248407643312,0.7836166924265843
Average,0.8869227449287872,0.7952941176470589,0.9287952688132236,0.8073248407643312,0.7836166924265843
15 changes: 2 additions & 13 deletions Zero-shot_classification/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,7 @@ def test(config):

# Write the data rows
csv_writer.writerows(table_data)
<<<<<<< HEAD

=======
>>>>>>> c7e9f45 (update result logs)
print(table)
log_csv = True
if log_csv:
Expand All @@ -479,17 +476,13 @@ def test(config):
header = ['Dataset', "Accuracy", "Max F1", "AUC ROC", "Precision", "Recall"]
log_to_csv(csv_filename, data, header)

<<<<<<< HEAD

# print('The average f1 is {F1_avg:.4f}'.format(F1_avg=f1_avg))
# print('The average ACC is {ACC_avg:.4f}'.format(ACC_avg=acc_avg))
# for i in range(len(target_class)):
# print('F1 of {} is {}'.format(target_class[i], max_f1s[i]))
# print('ACC of {} is {}'.format(target_class[i], accs[i]))

=======
# Print the table

>>>>>>> c7e9f45 (update result logs)

if __name__ == '__main__':
parser = argparse.ArgumentParser()
Expand All @@ -503,11 +496,7 @@ def test(config):
accelerator = Accelerator()
if args.model_path:
config['model_path'] = args.model_path
<<<<<<< HEAD

=======

>>>>>>> c7e9f45 (update result logs)

os.environ["CUDA_VISIBLE_DEVICES"] = args.gpu
if args.gpu != '-1':
torch.cuda.current_device()
Expand Down
21 changes: 3 additions & 18 deletions Zero-shot_classification/test.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
<<<<<<< HEAD
filenames=(chexpert_mavl chexray_mavl covid_mavl rsna_mavl siim_mavl padchest_rare_mavl padchest_seen_mavl padchest_unseen_mavl)
ckpts=(25 28 31 34 37 state)
# model_name=output_masked_text5e-1
model_name=mavl_fp16_40
for filename in "${filenames[@]}"; do
for ckpt in "${ckpts[@]}"; do
CUDA_VISIBLE_DEVICES=0 python test.py --config configs/${filename}.yaml --model_path ../checkpoints/${model_name}/checkpoint_${ckpt}.pth
done
done
=======
# filenames=(chexpert_mavl chexray_mavl covid_mavl rsna_mavl siim_mavl padchest_rare_mavl padchest_seen_mavl padchest_unseen_mavl)
filenames=(padchest_unseen_mavl)
# model_name=output_masked_text5e-1
for filename in "${filenames[@]}"; do
CUDA_VISIBLE_DEVICES=0 python test.py --config configs/${filename}.yaml --model_path ../checkpoints/checkpoint_full_40.pth
Expand All @@ -20,9 +7,7 @@ for filename in "${filenames[@]}"; do
CUDA_VISIBLE_DEVICES=0 python test.py --config configs/${filename}.yaml --model_path ../checkpoints/checkpoint_full_46.pth
done

# for filename in "${filenames[@]}"; do
# CUDA_VISIBLE_DEVICES=0 python test.py --config configs/${filename}.yaml --model_path ../checkpoints/checkpoint_short_37.pth
# done

for filename in "${filenames[@]}"; do
CUDA_VISIBLE_DEVICES=0 python test.py --config configs/${filename}.yaml --model_path ../checkpoints/checkpoint_short_37.pth
done

>>>>>>> c7e9f45 (update result logs)

0 comments on commit f4ee417

Please sign in to comment.