Implements ISV client model training

This algorithm is a legacy one. The API has changed since its implementation. New versions and forks will need to be updated.
This algorithm is splittable

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.

Group: main

Endpoint Name Data Format Nature
statistics tutorial/gmm_statistics/1 Input
template_id system/uint64/1 Input
model tutorial/isvmachine/1 Output

Unnamed group

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
84
 
1
import bob
2
import numpy
3
4
5
6
def gmm_from_data(data):
7
    """Unmangles a bob.machine.GMMMachine from a BEAT Data object"""
8
9
    dim_c, dim_d = data.means.shape
10
    gmm = bob.machine.GMMMachine(dim_c, dim_d)
11
    gmm.weights = data.weights
12
    gmm.means = data.means
13
    gmm.variances = data.variances
14
    gmm.variance_thresholds = data.variance_thresholds
15
    return gmm
16
17
18
def isvbase_from_data(data, ubm):
19
    """Unmangles a bob.machine.ISVBase from a BEAT Data object"""
20
21
    dim_cd, dim_u = data.subspace_u.shape
22
    isvbase = bob.machine.ISVBase(ubm, dim_u)
23
    isvbase.u = data.subspace_u
24
    isvbase.d = data.subspace_d
25
    return isvbase
26
27
28
def stats_from_data(data):
29
    """Unmangles a bob.machine.GMMStats from a BEAT Data object"""
30
31
    dim_c, dim_d = data.sum_px.shape
32
    stat = bob.machine.GMMStats(dim_c, dim_d)
33
    stat.t = long(data.t)
34
    stat.n = data.n
35
    stat.sum_px = data.sum_px
36
    stat.sum_pxx = data.sum_pxx
37
    return stat
38
39
40
41
42
class Algorithm:
43
44
    def __init__(self):
45
        self.ubm      = None
46
        self.isvbase  = None
47
        self.statistics = []
48
        self.isv_enroll_iterations = 1
49
50
    def setup(self, parameters):
51
        self.isv_enroll_iterations = parameters.get('isv-enroll-iterations', self.isv_enroll_iterations) 
52
        return True
53
54
    def process(self, inputs, outputs):
55
        # retrieve the UBM once
56
        if self.ubm is None:
57
            inputs['ubm'].next()
58
            self.ubm = gmm_from_data(inputs['ubm'].data)
59
60
        # retrieve the ISVBase once
61
        if self.isvbase is None:
62
            inputs['isvbase'].next()
63
            self.isvbase = isvbase_from_data(inputs['isvbase'].data, self.ubm)
64
65
        # collect all the features for the current template
66
        self.statistics.append(stats_from_data(inputs["statistics"].data))
67
68
69
        # adapts the UBM GMM for the template (when all the features have been collected)
70
        if inputs["template_id"].isDataUnitDone():
71
            model = bob.machine.ISVMachine(self.isvbase)
72
73
            trainer = bob.trainer.ISVTrainer()
74
            trainer.enrol(model, self.statistics, int(self.isv_enroll_iterations))
75
76
            # outputs data
77
            outputs["model"].write({
78
                'latent_z':             model.z,
79
            })
80
81
            self.statistics = []
82
83
        return True
84

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:

  • statistics: A set of GMM Statistics of a client for enrollment.
  • ubm: A GMM corresponding to the Universal Background Model.
  • isvbase: The subspace_u and subspace_d for the session and the client offset respectivelly.
  • template_id: Client (class/subject) identifier as an unsigned 64 bits integer.

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.

Experiments

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
Created with Raphaël 2.1.2[compare]tutorial/isv_enroll/32014Nov11

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.

Terms of Service | Contact Information | BEAT platform version 2.2.1b0 | © Idiap Research Institute - 2013-2025