if options.test_type == 'liveness': new_result_ = "{0}{1}{2}-result_.csv".format(directory, os.sep, version) shutil.copyfile(result, new_result_) cmd = "sed -i 's#-1#1#' {}".format(new_result_) subprocess.call(cmd,shell=True) if options.data_type == 'base': replace = '/home/andrew/code/data/tof/base_test_data/vivo-liveness/' else: replace = '' error_name = "{0}{1}{2}-result.xlsx".format(directory, os.sep, version) servers.get_liveness_server_result(new_result, file_name, label_name, replace=replace, error_name=error_name) roc = "{0}{1}{2}-roc.txt".format(directory, os.sep, version) count.roc(new_result_, label_name, output=roc) if options.test_type == 'gaze': fprs = [0.3,0.25,0.2,0.15,0.1,0.05,0.02,0.01,0.001] roc = "{0}{1}{2}-roc.txt".format(directory, os.sep, version) count.roc(result, label_name, fprs=fprs, output=roc, ) error_name = "{0}{1}{2}-result.xlsx".format(directory, os.sep, version) servers.get_gaze_server_result(new_result, file_name, label_name, error_name=error_name)
roc = "{0}{1}{2}-roc.txt".format(directory, os.sep, version) fprs = np.arange(0.10, 0, -0.01) count.roc(new_result_, label_name, output=roc, fprs=fprs) if options.test_type == 'gaze': fprs = [0.3, 0.25, 0.2, 0.15, 0.1, 0.05, 0.02, 0.01, 0.001] roc = "{0}{1}{2}-roc.txt".format(directory, os.sep, version) count.roc( result, label_name, fprs=fprs, output=roc, ) servers.get_gaze_server_result(new_result, file_name, label_name, error_name=error_name, type_=options.data_type) if options.test_type == 'verify': person_name = "{}{}{}".format(tool, os.sep, "output/i_enroll.txt") print(person_name) shutil.copyfile( person_name, "{}{}{}".format(directory, os.sep, os.path.basename(person_name))) roc = "{0}{1}{2}-roc.txt".format(directory, os.sep, version) count.verify_roc( result, label_name, output=roc, )
parser = argparse.ArgumentParser() parser.add_argument('labels', action="store", help=u'labels') parser.add_argument('files', action="store", help=u'测试图片列表文件') parser.add_argument('scores', action="store", help=u'服务器liveness结果') parser.add_argument('-s', action="store", dest="score", default=0.3, type=float, help=u'分数的门限') parser.add_argument('-o', action="store", dest="output", default="live_result.xlsx", help=u'结果输出目录') parser.add_argument('-t', action="store", dest="type", default="bug", help=u'测试类型') parser.add_argument('--version', action='version', version='%(prog)s 1.0 Rongzhong xu 2018 04 18') options = parser.parse_args() servers.get_gaze_server_result(options.scores, options.files, options.labels, error_name=options.output, type_=options.data_type) #values = [] #for i in range(18): #values.append(i*0.05+0.1) #df_score = pd.read_csv(options.scores, header=None, names=['score']) #df_file = pd.read_csv(options.files, header=None, names=['filename']) #df_label = pd.read_csv(options.labels, header=None, names=['label']) #df = pd.concat([df_label, df_score, df_file], axis=1) #results = []