-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsum_result.py
29 lines (25 loc) · 854 Bytes
/
sum_result.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import importlib
from collections import defaultdict
import numpy as np
module_name_list = [
"sam_med3d",
# "sam_med2d_ft2d"
]
for module_idx, module_name in enumerate(module_name_list):
try:
module = importlib.import_module("results."+module_name)
except:
raise ValueError("file not found", module_name)
dice_Ts = module.dice_Ts
final_results = defaultdict(list)
for k, v in dice_Ts.items():
k = k.split("/")
# print(k)
cls, dataset, data_type, case = k[-4], k[-3], k[-2], k[-1]
# print(cls, dataset, data_type, case)
final_results[cls].append(v*100)
print(f"-----[{module_name}]-------")
print("cls\t| dice")
for k, v in final_results.items():
print( k, "\t|", "{:.2f}%".format(float(np.mean(v))))
print("----------------------------")