Performs the UBM training (adapting weights and variances with seed)

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

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
features system/array_2d_floats/1 Input
ubm tutorial/gmm/1 Output

Parameters allow users to change the configuration of an algorithm when scheduling an experiment

Name Description Type Default Range/Choices
convergence-threshold float64 0.0005
seed uint32 5489
maximum-number-of-iterations uint32 500
number-of-gaussians uint32 512
xxxxxxxxxx
79
 
1
import bob
2
import numpy
3
from bob.machine import GMMMachine
4
5
6
7
class Algorithm:
8
9
    def __init__(self):
10
        self.number_of_gaussians = 512
11
        self.max_iterations = 500
12
        self.seed = 5489
13
        self.convergence_threshold = 0.0005
14
        self.data = []
15
16
17
    def setup(self, parameters):
18
        self.number_of_gaussians = parameters.get('number-of-gaussians',
19
                                                  self.number_of_gaussians)
20
21
        self.max_iterations = parameters.get('maximum-number-of-iterations',
22
                                             self.max_iterations)
23
24
        self.convergence_threshold = parameters.get('convergence-threshold',
25
                                             self.convergence_threshold)
26
        
27
        
28
        self.seed = parameters.get('seed',self.seed)
29
30
        return True
31
32
33
    def process(self, inputs, outputs):
34
        self.data.append(inputs["features"].data.value)
35
36
        if not(inputs.hasMoreData()):
37
            # create array set used for training
38
            training_set = numpy.vstack(self.data)
39
            input_size = training_set.shape[1]
40
41
            # create the KMeans and UBM machine
42
            kmeans = bob.machine.KMeansMachine(int(self.number_of_gaussians), input_size)
43
            ubm = bob.machine.GMMMachine(int(self.number_of_gaussians), input_size)
44
45
            # create the KMeansTrainer
46
            kmeans_trainer = bob.trainer.KMeansTrainer()
47
            kmeans_trainer.initialization_method = bob.trainer.KMeansTrainer.RANDOM_NO_DUPLICATE
48
            kmeans_trainer.max_iterations = int(self.max_iterations)
49
            kmeans_trainer.convergence_threshold = self.convergence_threshold
50
            kmeans_trainer.rng = bob.core.random.mt19937(int(self.seed))
51
52
            # train using the KMeansTrainer
53
            kmeans_trainer.train(kmeans, training_set)
54
55
            (variances, weights) = kmeans.get_variances_and_weights_for_each_cluster(training_set)
56
            means = kmeans.means
57
58
            # initialize the GMM
59
            ubm.means = means
60
            ubm.variances = variances
61
            ubm.weights = weights
62
63
            # train the GMM
64
            trainer = bob.trainer.ML_GMMTrainer(update_means=True, update_variances=True, update_weights=True)
65
            trainer.max_iterations = int(self.max_iterations)
66
            trainer.rng = bob.core.random.mt19937(int(self.seed))
67
            trainer.convergence_threshold = self.convergence_threshold
68
            trainer.train(ubm, training_set)
69
70
            # outputs data
71
            outputs["ubm"].write({
72
                'weights':              ubm.weights,
73
                'means':                ubm.means,
74
                'variances':            ubm.variances,
75
                'variance_thresholds':  ubm.variance_thresholds,
76
            })
77
78
        return True
79

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

For a Gaussian Mixture Models (GMM), this algorithm implements the Universal Background Model (UBM) training described in [Reynolds2000].

First, this algorithm estimates the means, diagonal covariance matrix and the weights of each gaussian component using the KMeans clustering. After, only the means are re-estimated using the Maximum Likelihood (ML) estimator.

This algorithm relies on the `Bob <http://www.idiap.ch/software/bob/>`_ library.

The input, features, is a training set of floating point vectors as a two-dimensional array of floats (64 bits), the number of rows corresponding to the number of training samples, and the number of columns to the dimensionality of the training samples. The output, ubm, is the GMM trained using the ML estimator.

[Reynolds2000]Reynolds, Douglas A., Thomas F. Quatieri, and Robert B. Dunn. "Speaker verification using adapted Gaussian mixture models." Digital signal processing 10.1 (2000): 19-41.

Docutils System Messages

System Message: ERROR/3 (<string>, line 6); backlink

Unknown target name: "bob &amp;amp;amp;lt;http://www.idiap.ch/software/bob/&amp;amp;amp;gt;".

Experiments

Updated Name Databases/Protocols Analyzers
smarcel/tpereira/full_isv_multi/2/btas2015_face-periocular_mobio-female_det mobio/1@female tutorial/eerhter_postperf_iso/1
tpereira/tpereira/full_isv/2/btas2015_periocular_mobio-female_det_bobv2-0 mobio/1@female tutorial/eerhter_postperf_iso/1
tpereira/tpereira/full_isv_multi/2/btas2015_face-periocular_cpqd-smartphone-male_det cpqd/1@smartphone_male tutorial/eerhter_postperf_iso/1
tpereira/tpereira/full_isv/2/btas2015_periocular_cpqd-smartphone-male_det cpqd/1@smartphone_male tutorial/eerhter_postperf_iso/1
tpereira/tpereira/full_isv/2/btas2015_face_cpqd-smartphone-male_det cpqd/1@smartphone_male tutorial/eerhter_postperf_iso/1
tpereira/tpereira/full_isv_multi/2/btas2015_face-periocular_mobio-male_det mobio/1@male tutorial/eerhter_postperf_iso/1
tpereira/tpereira/full_isv/2/btas2015_periocular_mobio-male_det mobio/1@male tutorial/eerhter_postperf_iso/1
tpereira/tpereira/full_isv/2/btas2015_face_mobio-male_det mobio/1@male tutorial/eerhter_postperf_iso/1
tpereira/tpereira/full_isv_multi/2/btas2015_face-periocular_cpqd-smartphone-female_det cpqd/1@smartphone_female tutorial/eerhter_postperf_iso/1
tpereira/tpereira/full_isv/2/btas2015_periocular_cpqd-smartphone-female_det cpqd/1@smartphone_female tutorial/eerhter_postperf_iso/1
tpereira/tpereira/full_isv/2/btas2015_face_cpqd-smartphone-female_det cpqd/1@smartphone_female tutorial/eerhter_postperf_iso/1
tpereira/tpereira/full_isv_multi/2/btas2015_face-periocular_mobio-female_det mobio/1@female tutorial/eerhter_postperf_iso/1
tpereira/tpereira/full_isv/2/btas2015_periocular_mobio-female_det mobio/1@female tutorial/eerhter_postperf_iso/1
tpereira/tpereira/full_isv/2/btas2015_face_mobio-female_det mobio/1@female tutorial/eerhter_postperf_iso/1
Created with Raphaël 2.1.2[compare]tpereira/ubm_training/1tpereira/ubm_training/2Aug29tpereira/ubm_training_nomalize_kmeans/12014Sep5tpereira/ubm_training/6Mar282015Jul22

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