Skip to content
Snippets Groups Projects
Commit 1fdb1b6f authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

Fixes verbosity; Fixes CMC plot (closes #20)

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