Commit 2fbac0b7 authored by Theophile GENTILHOMME's avatar Theophile GENTILHOMME

[script][pad_commands] re-introduce multi-metrics for pad

parent b5fd026d
Pipeline #21460 canceled with stage
in 42 seconds
...@@ -83,3 +83,16 @@ def hist(ctx, scores, evaluation, **kwargs): ...@@ -83,3 +83,16 @@ def hist(ctx, scores, evaluation, **kwargs):
def evaluate(ctx, scores, evaluation, **kwargs): def evaluate(ctx, scores, evaluation, **kwargs):
common_options.evaluate_flow( common_options.evaluate_flow(
ctx, scores, evaluation, metrics, roc, det, epc, hist, **kwargs) ctx, scores, evaluation, metrics, roc, det, epc, hist, **kwargs)
@common_options.multi_metrics_command(
common_options.MULTI_METRICS_HELP.format(
names='FtA, APCER, BPCER, FAR, FRR, ACER',
criteria=CRITERIA, score_format=SCORE_FORMAT,
command='bob pad multi-metrics'),
criteria=CRITERIA)
def multi_metrics(ctx, scores, evaluation, protocols_number, **kwargs):
ctx.meta['min_arg'] = protocols_number * (2 if evaluation else 1)
process = figure.MultiMetrics(
ctx, scores, evaluation, load.split)
process.run()
...@@ -24,6 +24,22 @@ class Metrics(bio_figure.Metrics): ...@@ -24,6 +24,22 @@ class Metrics(bio_figure.Metrics):
criterion, dev_neg, dev_pos, far) criterion, dev_neg, dev_pos, far)
class MultiMetrics(measure_figure.MultiMetrics):
'''Compute metrics from score files'''
def __init__(self, ctx, scores, evaluation, func_load):
super(MultiMetrics, self).__init__(
ctx, scores, evaluation, func_load,
names=('FtA', 'APCER', 'BPCER', 'FAR', 'FRR', 'ACER'))
def get_thres(self, criterion, dev_neg, dev_pos, far):
if self._criterion == 'bpcer20':
return calc_threshold('bpcer20', dev_neg, dev_pos)
else:
return super(MultiMetrics, self).get_thres(
criterion, dev_neg, dev_pos, far)
class Roc(bio_figure.Roc): class Roc(bio_figure.Roc):
'''ROC for PAD''' '''ROC for PAD'''
......
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