parser.add_argument('-d','--dev-files',required=True,nargs='+',help="A list of score files of the development set.")
parser.add_argument('-n','--report-name',default="report",help="The name of the report")
parser.add_argument('-r','--roc',action='store_true',default=False,help="Add ROC in the report")
parser.add_argument('-e','--det',action='store_true',default=False,help="Add DET in the report")
parser.add_argument('-s','--directory',default='.',help="A directory, where to find the --dev-files and the --eval-files")
parser.add_argument('-c','--criterion',choices=('EER','HTER'),help="If given, the threshold of the development set will be computed with this criterion.")
parser.add_argument('--cost',default=0.99,help='Cost for FAR in minDCF')
parser.add_argument('-r','--rr',action='store_true',help="If given, the Recognition Rate will be computed.")
parser.add_argument('-l','--legends',nargs='+',help="A list of legend strings used for ROC, CMC and DET plots; THE NUMBER OF PLOTS SHOULD BE MULTIPLE OF THE NUMBER OF LEGGENDS. IN THAT WAY, EACH SEGMENT WILL BE AVERAGED")
parser.add_argument('-i','--linestyle',nargs='+',help="A list of line styles ROC, CMC and DET plots; THE NUMBER OF PLOTS SHOULD BE MULTIPLE OF THE NUMBER OF LEGGENDS. IN THAT WAY, EACH SEGMENT WILL BE AVERAGED")
parser.add_argument('-F','--legend-font-size',type=int,default=18,help="Set the font size of the legends.")
parser.add_argument('-P','--legend-position',type=int,help="Set the font size of the legends.")
parser.add_argument('-R','--roc',help="If given, ROC curves will be plotted into the given pdf file.")
parser.add_argument('-D','--det',help="If given, DET curves will be plotted into the given pdf file.")
parser.add_argument('-C','--cmc',help="If given, CMC curves will be plotted into the given pdf file.")
parser.add_argument('--parser',default='4column',choices=('4column','5column'),help="The style of the resulting score files. The default fits to the usual output of score files.")
pdf.savefig(_plot_cmc(cmcs_dev,colors,args.legends,"CUHK-CUFS CMC between 5 splits",args.legend_font_size,args.legend_position))
exceptRuntimeErrorase:
raiseRuntimeError("During plotting of ROC curves, the following exception occured:\n%s\nUsually this happens when the label contains characters that LaTeX cannot parse."%e)
#if args.rr:
#logger.info("Computing recognition rate on the development ")
#for i in range(len(cmcs_dev)):
#rr = bob.measure.recognition_rate(cmcs_dev[i])
#print("The Recognition Rate of the development set of '%s' is %2.3f%%" % (args.legends[i], rr * 100.))
print("The %s of the development set of '%s' is %2.3f%%"%(args.criterion,args.legends[i],(far+frr)*50.))# / 2 * 100%
scores_dev=[score_parser(f)forfinargs.dev_files]
################ PLOTING ROC ##############
ifargs.roc:
logger.info("Plotting ROC curves to file '%s'",args.roc)
logger.info("Plotting ROC curves ")
try:
# create a multi-page PDF for the ROC curve
pdf=PdfPages(args.roc)
# create a separate figure for dev and eval
pdf.savefig(_plot_roc(scores_dev,colors,args.legends,"CUHK-CUFS ROC Curve between 5 splits",args.legend_font_size,args.legend_position))
#del frrs_dev
pdf.close()
exceptRuntimeErrorase:
raiseRuntimeError("During plotting of ROC curves, the following exception occured:\n%s\nUsually this happens when the label contains characters that LaTeX cannot parse."%e)
################ PLOTING DET ##############
ifargs.det:
logger.info("Computing DET curves on the development ")
#dets_dev = [bob.measure.det(scores[0], scores[1], 1000) for scores in scores_dev]
logger.info("Plotting DET curves to file '%s'",args.det)
logger.info("Plotting DET curves")
try:
# create a multi-page PDF for the ROC curve
pdf=PdfPages(args.det)
# create a separate figure for dev and eval
pdf.savefig(_plot_det(scores_dev,colors,args.legends,"CUHK-CUFS DET between 5 splits",args.legend_font_size,args.legend_position))
#del dets_dev
pdf.close()
exceptRuntimeErrorase:
raiseRuntimeError("During plotting of ROC curves, the following exception occured:\n%s\nUsually this happens when the label contains characters that LaTeX cannot parse."%e)
pdf.close()
ifargs.cmcorargs.rr:
logger.info("Loading CMC data on the development ")
logger.info("Plotting CMC curves to file '%s'",args.cmc)
try:
# create a multi-page PDF for the ROC curve
pdf=PdfPages(args.cmc)
# create a separate figure for dev and eval
pdf.savefig(_plot_cmc(cmcs_dev,colors,args.legends,"CUHK-CUFS CMC between 5 splits",args.legend_font_size,args.legend_position))
pdf.close()
exceptRuntimeErrorase:
raiseRuntimeError("During plotting of ROC curves, the following exception occured:\n%s\nUsually this happens when the label contains characters that LaTeX cannot parse."%e)
ifargs.rr:
logger.info("Computing recognition rate on the development ")
foriinrange(len(cmcs_dev)):
rr=bob.measure.recognition_rate(cmcs_dev[i])
print("The Recognition Rate of the development set of '%s' is %2.3f%%"%(args.legends[i],rr*100.))