Tools implemented in bob.bio.gmm

Summary

bob.bio.gmm.algorithm.GMM(number_of_gaussians) Algorithm for computing Universal Background Models and Gaussian Mixture Models of the features.
bob.bio.gmm.algorithm.ISV(…[, …]) Tool for computing Unified Background Models and Gaussian Mixture Models of the features
bob.bio.gmm.algorithm.JFA(…[, …]) Tool for computing Unified Background Models and Gaussian Mixture Models of the features and project it via JFA
bob.bio.gmm.algorithm.IVector(…[, …]) Tool for extracting I-Vectors

Details

class bob.bio.gmm.algorithm.GMM(number_of_gaussians, kmeans_training_iterations=25, gmm_training_iterations=25, training_threshold=0.0005, variance_threshold=0.0005, update_weights=True, update_means=True, update_variances=True, relevance_factor=4, gmm_enroll_iterations=1, responsibility_threshold=0, INIT_SEED=5489, scoring_function=<built-in function linear_scoring>, n_threads=None)

Bases: bob.bio.base.algorithm.Algorithm

Algorithm for computing Universal Background Models and Gaussian Mixture Models of the features. Features must be normalized to zero mean and unit standard deviation.

enroll(feature_arrays)[source]

Enrolls a GMM using MAP adaptation, given a list of 2D numpy.ndarray’s of feature vectors

enroll_gmm(array)[source]
load_projector(projector_file)[source]

Reads the UBM model from file

load_ubm(ubm_file)[source]
project(feature)[source]

Computes GMM statistics against a UBM, given an input 2D numpy.ndarray of feature vectors

project_ubm(array)[source]
read_feature(feature_file)[source]

Read the type of features that we require, namely GMM_Stats

read_gmm_stats(gmm_stats_file)[source]

Reads GMM stats from file.

read_model(model_file)[source]

Reads the model, which is a GMM machine

save_ubm(projector_file)[source]

Save projector to file

score(model, probe)[source]

Computes the score for the given model and the given probe using the scoring function from the config file

score_for_multiple_probes(model, probes)[source]

This function computes the score between the given model and several given probe files.

train_projector(train_features, projector_file)[source]

Computes the Universal Background Model from the training (“world”) data

train_ubm(array)[source]
class bob.bio.gmm.algorithm.GMMRegular(**kwargs)

Bases: bob.bio.gmm.algorithm.GMM

Algorithm for computing Universal Background Models and Gaussian Mixture Models of the features

load_enroller(enroller_file)[source]

Reads the UBM model from file

score(model, probe)[source]

Computes the score for the given model and the given probe. The score are Log-Likelihood. Therefore, the log of the likelihood ratio is obtained by computing the following difference.

score_for_multiple_probes(model, probes)[source]

This function computes the score between the given model and several given probe files.

train_enroller(train_features, enroller_file)[source]

Computes the Universal Background Model from the training (“world”) data

class bob.bio.gmm.algorithm.ISV(subspace_dimension_of_u, isv_training_iterations=10, isv_enroll_iterations=1, multiple_probe_scoring=None, **kwargs)

Bases: bob.bio.gmm.algorithm.GMM

Tool for computing Unified Background Models and Gaussian Mixture Models of the features

enroll(enroll_features)[source]

Performs ISV enrollment

load_isv(isv_file)[source]
load_projector(projector_file)[source]

Load the GMM and the ISV model from the same HDF5 file

project(feature)[source]

Computes GMM statistics against a UBM, then corresponding Ux vector

project_isv(projected_ubm)[source]
read_feature(feature_file)[source]

Read the type of features that we require, namely GMMStats

read_model(model_file)[source]

Reads the ISV Machine that holds the model

save_projector(projector_file)[source]

Save the GMM and the ISV model in the same HDF5 file

score(model, probe)[source]

Computes the score for the given model and the given probe.

score_for_multiple_probes(model, probes)[source]

This function computes the score between the given model and several given probe files.

train_isv(data)[source]

Train the ISV model given a dataset

train_projector(train_features, projector_file)[source]

Train Projector and Enroller at the same time

write_feature(data, feature_file)[source]

Saves the given projected feature to a file with the given name. In this base class implementation:

  • If the given feature has a save attribute, it calls feature.save(bob.io.base.HDF5File(feature_file), 'w'). In this case, the given feature_file might be either a file name or a bob.io.base.HDF5File.
  • Otherwise, it uses bob.io.base.save() to do that.

If you have a different format, please overwrite this function.

Please register ‘performs_projection = True’ in the constructor to enable this function.

Parameters:

feature : object
A feature as returned by the project() function, which should be written.
feature_file : str or bob.io.base.HDF5File
The file open for writing, or the file name to write to.
class bob.bio.gmm.algorithm.IVector(subspace_dimension_of_t, tv_training_iterations=25, update_sigma=True, use_whitening=True, use_lda=False, use_wccn=False, use_plda=False, lda_dim=None, lda_strip_to_rank=True, plda_dim_F=50, plda_dim_G=50, plda_training_iterations=50, **kwargs)

Bases: bob.bio.gmm.algorithm.GMM

Tool for extracting I-Vectors

enroll(enroll_features)[source]

Performs IVector enrollment

load_lda(lda_file)[source]
load_plda(plda_file)[source]
load_projector(projector_file)[source]

Load the GMM and the ISV model from the same HDF5 file

load_tv(tv_file)[source]
load_wccn(wccn_file)[source]
load_whitener(whitening_file)[source]
project(feature_array)[source]

Computes GMM statistics against a UBM, then corresponding Ux vector

project_ivector(gmm_stats)[source]
project_lda(ivector)[source]
project_wccn(ivector)[source]
project_whitening(ivector)[source]
read_feature(feature_file)[source]

Read the type of features that we require, namely i-vectors (stored as simple numpy arrays)

read_model(model_file)[source]

Reads the whitened i-vector that holds the model

save_projector(projector_file)[source]
score(model, probe)[source]

Computes the score for the given model and the given probe.

score_for_multiple_probes(model, probes)[source]

This function computes the score between the given model and several given probe files.

train_ivector(training_stats)[source]
train_lda(training_features)[source]
train_plda(training_features)[source]
train_projector(train_features, projector_file)[source]

Train Projector and Enroller at the same time

train_wccn(training_features)[source]
train_whitener(training_features)[source]
write_feature(data, feature_file)[source]

Saves the feature, which is the (whitened) I-Vector.

class bob.bio.gmm.algorithm.JFA(subspace_dimension_of_u, subspace_dimension_of_v, jfa_training_iterations=10, jfa_enroll_iterations=1, **kwargs)

Bases: bob.bio.gmm.algorithm.GMM

Tool for computing Unified Background Models and Gaussian Mixture Models of the features and project it via JFA

enroll(enroll_features)[source]

Enrolls a GMM using MAP adaptation

load_enroller(enroller_file)[source]

Reads the JFA base from file

load_projector(projector_file)[source]

Reads the UBM model from file

read_feature(feature_file)[source]

Reads the projected feature to be enrolled as a model

read_model(model_file)[source]

Reads the JFA Machine that holds the model

score(model, probe)[source]

Computes the score for the given model and the given probe

score_for_multiple_probes(model, probes)[source]

This function computes the score between the given model and several probes.

train_enroller(train_features, enroller_file)[source]

This function can be overwritten to train the model enroller. If you do this, please also register the function by calling this base class constructor and enabling the training by require_enroller_training = True.

Parameters:

training_features : [object] or [[object]]
A list of extracted features that can be used for training the projector. Features will be split into lists, each of which contains the features of a single (training-)client.
enroller_file : str
The file to write. This file should be readable with the load_enroller() function.