elif real == 0 and fake == 255: FP += 1 elif real == 0 and fake == 0: TN += 1 return TP / count, FP / count, FN / count, TN / count if __name__ == '__main__': opt = TestOptions().parse() if 'txt' not in opt.phase: opt.phase = opt.phase + '.txt' opt.dir_AB = os.path.join(opt.dataroot, opt.phase) # get the image directory opt.AB_paths = open(opt.dir_AB).read().split('\n') # get image paths #list = ['real_B','fake_B'] #list = ['data_B','output'] list = ['mask_B', 'mask_fake_B'] sum_value = 0.0 for i, path in enumerate(opt.AB_paths): short_path = path.split() name = ntpath.basename(short_path[0]) name = os.path.splitext(name)[0] # print(name)git val_dir = './results/experiment_name/branch/val.txt_latest_iter400/images/' name_A = '%s_%s.png' % (name, list[0]) name_B = '%s_%s.png' % (name, list[1])