53 lines
866 B
Python
Executable File
53 lines
866 B
Python
Executable File
import json
|
|
import glob
|
|
import numpy as np
|
|
import matplotlib.pyplot as plt
|
|
|
|
from tqdm import tqdm
|
|
from multiprocessing import Pool
|
|
|
|
from utils.labelme import get_mask_v2
|
|
from utils.e2e_metrics import get_metrics
|
|
|
|
|
|
def get_score():
|
|
|
|
res = get_metrics(
|
|
label,
|
|
get_mask_v2(pred[0]))
|
|
|
|
|
|
return res
|
|
|
|
|
|
def get_score_v():
|
|
|
|
res = get_metrics(
|
|
np.array(label > 1),
|
|
get_mask_v2(pred[0])
|
|
)
|
|
|
|
return res
|
|
|
|
|
|
with open('/home/gao/mouclear/cc/data/new_v3/patch_unet/test_10s/version_4/test_10s.json') as f:
|
|
data = json.load(f)
|
|
|
|
img_path = np.array(data['img_path'])
|
|
|
|
label = np.array(data['label']) # [metric_idx]
|
|
pred = np.array(data['pred']) # [metric_idx]
|
|
|
|
# label = np.array([label])
|
|
|
|
nums = label.shape[0]; nums
|
|
|
|
a = get_score()
|
|
b = get_score_v()
|
|
|
|
print(a)
|
|
print(b)
|
|
|
|
# print(np.mean(a, axis=0))
|
|
|
|
# print(np.mean(b, axis=0)) |