Commit 1fdb1b6f authored by André Anjos's avatar André Anjos 💬

Fixes verbosity; Fixes CMC plot (closes #20)

parent ba52bf43
Pipeline #5202 passed with stages
in 5 minutes and 50 seconds
......@@ -542,6 +542,7 @@ def detection_identification_curve(cmc_scores, far_values = log_values(), rank
# for each probe, for which no positives exists, get the highest negative score; and sort them to compute the FAR thresholds
negatives = sorted(max(neg) for neg,pos in cmc_scores if (pos is None or not numpy.array(pos).size) and neg is not None)
if not negatives:
import ipdb; ipdb.set_trace()
raise ValueError("There need to be at least one pair with only negative scores")
# compute thresholds based on FAR values
......
......@@ -33,10 +33,8 @@ Examples:
import os
import sys
import logging
__logging_format__='[%(levelname)s] %(message)s'
logging.basicConfig(format=__logging_format__)
logger = logging.getLogger('bob')
import bob.core
logger = bob.core.log.setup("bob.measure")
from .eval_threshold import apthres
......@@ -63,8 +61,8 @@ def main(user_input=None):
)
# Sets-up logging
if args['--verbose'] == 1: logging.getLogger().setLevel(logging.INFO)
elif args['--verbose'] >= 2: logging.getLogger().setLevel(logging.DEBUG)
verbosity = int(args['--verbose'])
bob.core.log.set_verbosity_level(logger, verbosity)
# handles threshold validation
try:
......
......@@ -47,10 +47,8 @@ Examples:
import os
import sys
import logging
__logging_format__='[%(levelname)s] %(message)s'
logging.basicConfig(format=__logging_format__)
logger = logging.getLogger('bob')
import bob.core
logger = bob.core.log.setup("bob.measure")
def apthres(neg, pos, thres):
......@@ -108,8 +106,8 @@ def main(user_input=None):
)
# Sets-up logging
if args['--verbose'] == 1: logging.getLogger().setLevel(logging.INFO)
elif args['--verbose'] >= 2: logging.getLogger().setLevel(logging.DEBUG)
verbosity = int(args['--verbose'])
bob.core.log.set_verbosity_level(logger, verbosity)
# validates criterion
valid_criteria = ('eer', 'mhter', 'mwer')
......
......@@ -32,6 +32,9 @@ from __future__ import print_function
import os
import sys
import bob.core
logger = bob.core.log.setup("bob.measure")
def main(user_input=None):
......@@ -55,8 +58,8 @@ def main(user_input=None):
)
# Sets-up logging
if args['--verbose'] == 1: logging.getLogger().setLevel(logging.INFO)
elif args['--verbose'] >= 2: logging.getLogger().setLevel(logging.DEBUG)
verbosity = int(args['--verbose'])
bob.core.log.set_verbosity_level(logger, verbosity)
# Validates rank
if args['--rank'] is not None:
......@@ -90,7 +93,11 @@ def main(user_input=None):
# compute recognition rate
from .. import recognition_rate
rr = recognition_rate(data, args['--rank'])
if args['--rank'] is not None:
rr = recognition_rate(data, rank=args['--rank'])
else:
rr = recognition_rate(data)
print("Recognition rate for score file %s is %3.2f%%" % (args['<scores>'],
rr * 100))
......
......@@ -56,10 +56,8 @@ Options:
import os
import sys
import logging
__logging_format__='[%(levelname)s] %(message)s'
logging.basicConfig(format=__logging_format__)
logger = logging.getLogger('bob')
import bob.core
logger = bob.core.log.setup("bob.measure")
class Result:
......@@ -197,8 +195,8 @@ def main(user_input=None):
)
# Sets-up logging
if args['--verbose'] == 1: logging.getLogger().setLevel(logging.INFO)
elif args['--verbose'] >= 2: logging.getLogger().setLevel(logging.DEBUG)
verbosity = int(args['--verbose'])
bob.core.log.set_verbosity_level(logger, verbosity)
# checks sort-key
valid_sort_keys = 'nonorm_dev nonorm_eval ztnorm_dev ztnorm_eval dir'.split()
......
......@@ -216,10 +216,10 @@ def test_plots():
# EPC curve, you need to have a development and a test set. We will split,
# by the middle, the negatives and positives sample we have, just for the
# sake of testing
dev_negatives = negatives[:(negatives.shape[0]/2)]
test_negatives = negatives[(negatives.shape[0]/2):]
dev_positives = positives[:(positives.shape[0]/2)]
test_positives = positives[(positives.shape[0]/2):]
dev_negatives = negatives[:int(negatives.shape[0]/2)]
test_negatives = negatives[int(negatives.shape[0]/2):]
dev_positives = positives[:int(positives.shape[0]/2)]
test_positives = positives[int(positives.shape[0]/2):]
xy = epc(dev_negatives, dev_positives,
test_negatives, test_positives, 100)
# uncomment the next line to save a reference value
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment