name = name.split("\n")[0].strip() targets_names.append(name) targets_paths = [] results_paths = [] for name in targets_names: targets_path = os.path.join(paths["targets_path"], name + ".png") targets_paths.append(targets_path) result_path = os.path.join(paths["results_path"] , name + ".npy") results_paths.append(result_path) if __name__ == "__main__": evl = Evaluator(targets_paths , results_paths) P, R, thres = evl.calc_PR_curve(300) plt.plot(R,P) plt.show() f_score = -1 f_thres = -1 index = 0 for p,r,t in zip(P,R,thres.tolist()): if(p == 0 or r == 0): continue f1 = 2*p*r/(p + r) if(f1 > f_score ): f_score = f1 f_thres = t index += 1