Vanilla Biometrics callback

parent e8e95bf0
Pipeline #51684 failed with stage
in 176 minutes and 43 seconds
#!/usr/bin/env python
# coding: utf-8
Some TF callbacks
import tensorflow as tf
from click.testing import CliRunner
from import vanilla_biometrics
import logging
import bob.measure
import os
logger = logging.getLogger(__name__)
class VanillaBiometricsCallback(tf.keras.callbacks.Callback):
def __init__(self, config, output_path, name="vanilla-biometrics", fmr=0.001):
Callback that calls `bob bio pipelines vanilla-biometrics` at every `on_epoch_end`.
FNMR@FMR=fmr is reported at every epoch
config: str
Path containing the `bob bio pipelines vanilla-biometrics` input script.
Please, check :any:`` on how to setup the
output_path: str
Path where the checkpoiny is being written
fmr: float
False match rate threshold that will be used to compute FNRM
self.config = config
self.fmr = fmr
self.output_path = output_path
self.scores_dev = os.path.join(output_path, "scores-dev")
super(VanillaBiometricsCallback, self).__init__()
def on_epoch_end(self, epoch, logs=None):"Run vanilla biometrics {epoch}. Input script: {self.config}")
prog_name="bob bio pipelines vanilla-biometrics",
neg, pos =
far_thres = bob.measure.far_threshold(neg, pos, self.fmr)
fmr, fnmr = bob.measure.fprfnr(neg, pos, far_thres)
logs[f"FNMR-at-FAR={self.fmr}"] = fnmr
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment