Implements ISV client model training
Algorithms have at least one input and one output. All algorithm endpoints are organized in groups. Groups are used by the platform to indicate which inputs and outputs are synchronized together. The first group is automatically synchronized with the channel defined by the block in which the algorithm is deployed.
Endpoint Name | Data Format | Nature |
---|---|---|
statistics | tutorial/gmm_statistics/1 | Input |
template_id | system/uint64/1 | Input |
model | tutorial/isvmachine/1 | Output |
Endpoint Name | Data Format | Nature |
---|---|---|
ubm | tutorial/gmm/1 | Input |
isvbase | tutorial/isvbase/1 | Input |
Parameters allow users to change the configuration of an algorithm when scheduling an experiment
Name | Description | Type | Default | Range/Choices |
---|---|---|---|---|
isv-enroll-iterations | uint32 | 1 |
xxxxxxxxxx
import bob
import numpy
def gmm_from_data(data):
"""Unmangles a bob.machine.GMMMachine from a BEAT Data object"""
dim_c, dim_d = data.means.shape
gmm = bob.machine.GMMMachine(dim_c, dim_d)
gmm.weights = data.weights
gmm.means = data.means
gmm.variances = data.variances
gmm.variance_thresholds = data.variance_thresholds
return gmm
def isvbase_from_data(data, ubm):
"""Unmangles a bob.machine.ISVBase from a BEAT Data object"""
dim_cd, dim_u = data.subspace_u.shape
isvbase = bob.machine.ISVBase(ubm, dim_u)
isvbase.u = data.subspace_u
isvbase.d = data.subspace_d
return isvbase
def stats_from_data(data):
"""Unmangles a bob.machine.GMMStats from a BEAT Data object"""
dim_c, dim_d = data.sum_px.shape
stat = bob.machine.GMMStats(dim_c, dim_d)
stat.t = long(data.t)
stat.n = data.n
stat.sum_px = data.sum_px
stat.sum_pxx = data.sum_pxx
return stat
class Algorithm:
def __init__(self):
self.ubm = None
self.isvbase = None
self.statistics = []
self.isv_enroll_iterations = 1
def setup(self, parameters):
self.isv_enroll_iterations = parameters.get('isv-enroll-iterations', self.isv_enroll_iterations)
return True
def process(self, inputs, outputs):
# retrieve the UBM once
if self.ubm is None:
inputs['ubm'].next()
self.ubm = gmm_from_data(inputs['ubm'].data)
# retrieve the ISVBase once
if self.isvbase is None:
inputs['isvbase'].next()
self.isvbase = isvbase_from_data(inputs['isvbase'].data, self.ubm)
# collect all the features for the current template
self.statistics.append(stats_from_data(inputs["statistics"].data))
# adapts the UBM GMM for the template (when all the features have been collected)
if inputs["template_id"].isDataUnitDone():
model = bob.machine.ISVMachine(self.isvbase)
trainer = bob.trainer.ISVTrainer()
trainer.enrol(model, self.statistics, int(self.isv_enroll_iterations))
# outputs data
outputs["model"].write({
'latent_z': model.z,
})
self.statistics = []
return True
The code for this algorithm in Python
The ruler at 80 columns indicate suggested POSIX line breaks (for readability).
The editor will automatically enlarge to accomodate the entirety of your input
Use keyboard shortcuts for search/replace and faster editing. For example, use Ctrl-F (PC) or Cmd-F (Mac) to search through this box
Given a feature vector, a GMM and a U subspace, computes the Intersession Variability Modeling (ISV) client model. Basically, this algorithm computes the latent variable zi excluding possible session factors (described by the latent variable xi, j).
Specific details can be found in [McCool2013]:
This algorithm relies on the Bob library.
The inputs are:
The output, model, is the latent variable zi ( Eq. (31) in [McCool2013]) that corresponds to the client offset (with the session variations suppressed)
[McCool2013] | (1, 2) McCool, Christopher, et al. "Session variability modelling for face authentication." IET biometrics 2.3 (2013): 117-129. |
Updated | Name | Databases/Protocols | Analyzers | |||
---|---|---|---|---|---|---|
smarcel/tutorial/full_isv/2/mobio_male-gmm_100Gx10I-isv_50Ux10Ix4R-dct_12Bx8Ox45C-seed101 | mobio/1@male | tutorial/eerhter_postperf_iso/1 | ||||
tutorial/tutorial/full_isv/2/bancaMc_isv_DCT12x8_100G_U50 | banca/1@Mc | tutorial/eerhter_postperf_iso/1 | ||||
tutorial/tutorial/full_isv/2/xm2vtsLp1_isv_DCT12x8_100G_U50 | xm2vts/1@lp1 | tutorial/eerhter_postperf_iso/1 | ||||
tutorial/tutorial/full_isv/2/mobioMale_isv_DCT12x8_100G_U50 | mobio/1@male | tutorial/eerhter_postperf_iso/1 | ||||
tutorial/tutorial/full_isv/2/bancaP_isv_DCT12x8_100G_U50 | banca/1@P | tutorial/eerhter_postperf_iso/1 | ||||
tutorial/tutorial/full_isv/2/atnt_isv_DCT12x8_100G_U50 | atnt/1@idiap_test_eyepos | tutorial/eerhter_postperf_iso/1 |
This table shows the number of times this algorithm has been successfully run using the given environment. Note this does not provide sufficient information to evaluate if the algorithm will run when submitted to different conditions.