Computes the ISV session offset
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 |
isv_offset | system/array_1d_floats/1 | Output |
Endpoint Name | Data Format | Nature |
---|---|---|
ubm | tutorial/gmm/1 | Input |
isvbase | tutorial/isvbase/1 | Input |
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
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)
stats = stats_from_data(inputs["statistics"].data)
projected_isv = numpy.ndarray(shape=(self.ubm.dim_c*self.ubm.dim_d,), dtype=numpy.float64)
model = bob.machine.ISVMachine(self.isvbase)
model.estimate_ux(stats, projected_isv)
# outputs data
outputs["isv_offset"].write({
'value': projected_isv,
})
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 session offset (xi, j).
Specific details can be found in [McCool2013].
This algorithm relies on the Bob library.
The inputs are:
The output, isv_offset, is the latent variable xi, j ( Eq. (29) in [McCool2013]) that corresponds to the session offset.
[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.