@@ -28,7 +28,7 @@ def get_results(model, ds):
2828 return results
2929
3030
31- def compile_results (models , datasets , out_path ):
31+ def compile_results (models , datasets , out_path , load_results = False ):
3232 results = []
3333
3434 for model in models :
@@ -43,6 +43,11 @@ def compile_results(models, datasets, out_path):
4343 results .append (model_results )
4444
4545 results = pd .concat (results )
46+ if load_results :
47+ assert os .path .exists (out_path )
48+ all_results = pd .read_csv (out_path )
49+ results = pd .concat ([all_results , results ])
50+
4651 results .to_csv (out_path , index = False )
4752
4853
@@ -54,13 +59,39 @@ def compile_em():
5459 )
5560
5661
62+ def add_cellpose_results (datasets , out_path ):
63+ cp_root = "/scratch/projects/nim00007/sam/experiments/cellpose"
64+
65+ results = []
66+ for dataset in datasets :
67+ res_path = os .path .join (cp_root , dataset , "cellpose.csv" )
68+ ds_res = pd .read_csv (res_path )
69+ ds_res .insert (0 , "prompt" , ["cellpose" ] * ds_res .shape [0 ])
70+ ds_res .insert (0 , "dataset" , [dataset ] * ds_res .shape [0 ])
71+ results .append (ds_res )
72+
73+ results = pd .concat (results )
74+ results .insert (0 , "model" , ["cellpose" ] * results .shape [0 ])
75+
76+ all_results = pd .read_csv (out_path )
77+ results = pd .concat ([all_results , results ])
78+ results .to_csv (out_path , index = False )
79+
80+
5781def compile_lm ():
82+ res_path = os .path .join (EXPERIMENT_ROOT , "evaluation-lm.csv" )
5883 compile_results (
59- ["vit_h" , "vit_h_lm" , "vit_b" , "vit_b_lm" ],
60- LM_DATASETS ,
61- os .path .join (EXPERIMENT_ROOT , "evaluation-lm.csv" )
84+ ["vit_h" , "vit_h_lm" , "vit_b" , "vit_b_lm" ], LM_DATASETS , res_path
6285 )
6386
87+ # add the deepbacs and tissuenet specialist results
88+ assert os .path .exists (res_path )
89+ compile_results (["vit_h_tissuenet" , "vit_b_tissuenet" ], ["tissuenet" ], res_path , True )
90+ compile_results (["vit_h_deepbacs" , "vit_b_deebacs" ], ["deepbacs" ], res_path , True )
91+
92+ # add the cellpose results
93+ add_cellpose_results (LM_DATASETS , res_path )
94+
6495
6596def main ():
6697 # compile_em()
0 commit comments