Skip to content

Instantly share code, notes, and snippets.

@meghbhalerao
Created October 21, 2020 15:46
Show Gist options
  • Save meghbhalerao/4abe0b2fb93df8738ee7626b3e283670 to your computer and use it in GitHub Desktop.
Save meghbhalerao/4abe0b2fb93df8738ee7626b3e283670 to your computer and use it in GitHub Desktop.
import os
import numpy as np
folds = [5,5]
exp_path = "./outputs/resunet_e1_new/"
avg_dice = []
for holdout in os.listdir(os.path.join(exp_path)):
for fold in os.listdir(os.path.join(exp_path,holdout)):
if not ".pkl" in fold:
for item in os.listdir(os.path.join(exp_path,holdout,fold)):
if "stdout" in item:
f = open(os.path.join(exp_path,holdout,fold,item))
f_list = []
dice = []
for line in f:
if "w.r.t" in line:
dice.append(line.split()[-1])
avg_dice.append(dice[-1])
print(len(avg_dice))
new_list = []
for item in avg_dice:
new_list.append(float(item))
dce = sum(new_list)/len(new_list)
print(dce)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment