Tools implemented in bob.bio.spear

Summary

Databases

bob.bio.spear.database.ASVspoofBioDatabase(…) Implements verification API for querying ASVspoof database.
bob.bio.spear.database.AVspoofBioDatabase(…) Implements verification API for querying AVspoof database.
bob.bio.spear.database.MobioBioDatabase([…]) Implements verification API for querying Mobio database.
bob.bio.spear.database.VoicePABioDatabase(…) Implements verification API for querying VoicePA database.

Speech Preprocessors

bob.bio.spear.preprocessor.Base(**kwargs) Performs color space adaptations and data type corrections for the given image
bob.bio.spear.preprocessor.Energy_2Gauss([…]) Extracts the Energy
bob.bio.spear.preprocessor.Energy_Thr([…]) VAD based on the thresholded energy
bob.bio.spear.preprocessor.Mod_4Hz([…]) VAD based on the modulation of the energy around 4 Hz and the energy
bob.bio.spear.preprocessor.External([…]) Uses external VAD and converts it to fit the format used by Spear

Voice Feature Extractors

bob.bio.spear.extractor.Cepstral([…]) Extracts the Cepstral features
bob.bio.spear.extractor.SPROFeatures([…]) Extracts the Cepstral features
bob.bio.spear.extractor.HTKFeatures([…]) Extracts the Cepstral features

Databases

Feature extraction tools

class bob.bio.spear.database.ASVspoof2017BioDatabase(**kwargs)

Bases: bob.bio.base.database.BioDatabase

Implements verification API for querying ASVspoof2017 database.

annotations(file)[source]
model_ids_with_protocol(groups=None, protocol=None, gender=None)[source]
objects(protocol=None, purposes=None, model_ids=None, groups=None, **kwargs)[source]
class bob.bio.spear.database.ASVspoofBioDatabase(**kwargs)

Bases: bob.bio.base.database.BioDatabase

Implements verification API for querying ASVspoof database.

annotations(file)[source]
model_ids_with_protocol(groups=None, protocol=None, gender=None)[source]
objects(protocol=None, purposes=None, model_ids=None, groups=None, **kwargs)[source]
class bob.bio.spear.database.AVspoofBioDatabase(**kwargs)

Bases: bob.bio.base.database.BioDatabase

Implements verification API for querying AVspoof database.

annotations(file)[source]
model_ids_with_protocol(groups=None, protocol=None, gender=None)[source]
objects(protocol=None, purposes=None, model_ids=None, groups=None, **kwargs)[source]
class bob.bio.spear.database.AudioBioFile(client_id, path, file_id, **kwargs)

Bases: bob.bio.base.database.BioFile

load(directory=None, extension='.wav')[source]
class bob.bio.spear.database.MobioBioDatabase(original_directory=None, original_extension=None, annotation_directory=None, annotation_extension='.pos', **kwargs)

Bases: bob.bio.base.database.ZTBioDatabase

Implements verification API for querying Mobio database.

annotations(file)[source]
model_ids_with_protocol(groups=None, protocol=None, gender=None)[source]
objects(groups=None, protocol=None, purposes=None, model_ids=None, **kwargs)[source]
tmodel_ids_with_protocol(protocol=None, groups=None, **kwargs)[source]
tobjects(groups=None, protocol=None, model_ids=None, **kwargs)[source]
zobjects(groups=None, protocol=None, **kwargs)[source]
class bob.bio.spear.database.VoicePABioDatabase(**kwargs)

Bases: bob.bio.base.database.BioDatabase

Implements verification API for querying VoicePA database.

annotations(file)[source]
model_ids_with_protocol(groups=None, protocol=None, gender=None)[source]
objects(protocol=None, purposes=None, model_ids=None, groups=None, **kwargs)[source]

Preprocessors

class bob.bio.spear.preprocessor.Base(**kwargs)

Bases: bob.bio.base.preprocessor.Preprocessor

Performs color space adaptations and data type corrections for the given image

read_data(data_file)[source]
write_data(data, data_file, compression=0)[source]

Writes the given preprocessed data to a file with the given name.

class bob.bio.spear.preprocessor.Energy_2Gauss(max_iterations=10, convergence_threshold=0.0005, variance_threshold=0.0005, win_length_ms=20.0, win_shift_ms=10.0, smoothing_window=10, **kwargs)

Bases: bob.bio.spear.preprocessor.Base

Extracts the Energy

class bob.bio.spear.preprocessor.Energy_Thr(win_length_ms=20.0, win_shift_ms=10.0, smoothing_window=10, ratio_threshold=0.15, **kwargs)

Bases: bob.bio.spear.preprocessor.Base

VAD based on the thresholded energy

class bob.bio.spear.preprocessor.External(win_length_ms=20.0, win_shift_ms=10.0, **kwargs)

Bases: bob.bio.spear.preprocessor.Base

Uses external VAD and converts it to fit the format used by Spear

use_existing_vad(inArr, vad_file)[source]
class bob.bio.spear.preprocessor.Mod_4Hz(max_iterations=10, convergence_threshold=0.0005, variance_threshold=0.0005, win_length_ms=20.0, win_shift_ms=10.0, smoothing_window=10, n_filters=40, f_min=0.0, f_max=4000, pre_emphasis_coef=1.0, ratio_threshold=0.1, **kwargs)

Bases: bob.bio.spear.preprocessor.Base

VAD based on the modulation of the energy around 4 Hz and the energy

averaging(list_1s_shift)[source]
bandpass_firwin(ntaps, lowcut, highcut, fs, window='hamming')[source]
mod_4hz(rate_wavsample)[source]

Computes and returns the 4Hz modulation energy features for the given input wave file

modulation_4hz(filtering_res, rate_wavsample)[source]
pass_band_filtering(energy_bands, fs)[source]

Extractors

Feature extraction tools

class bob.bio.spear.extractor.CQCCFeatures(split_training_data_by_client=False, features_mask=array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]), **kwargs)

Bases: bob.bio.base.preprocessor.Preprocessor, bob.bio.base.extractor.Extractor

This class should be used as a preprocessor (converts matlab data into HDF5) and an extractor (reads saved data)

Converts pre-computed with Matlab CQCC features into numpy array suitable for Bob-based experiments. CQCC features are obtained using CQCC Matlab toolkit from http://audio.eurecom.fr/content/software The features are originally proposed in the following paper: Todisco, Massimiliano; Delgado, Héctor; Evans, Nicholas “Articulation rate filtering of CQCC features for automatic speaker verification”, INTERSPEECH 2016, Annual Conference of the International Speech Communication Association, September 8-12, 2016, San Francisco, USA

read_matlab_files(biofile, directory, extension)[source]

Read pre-computed CQCC Matlab features here

class bob.bio.spear.extractor.Cepstral(win_length_ms=20, win_shift_ms=10, n_filters=24, dct_norm=False, f_min=0.0, f_max=4000, delta_win=2, mel_scale=True, with_energy=True, with_delta=True, with_delta_delta=True, n_ceps=19, pre_emphasis_coef=0.95, features_mask=array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59]), normalize_flag=True, **kwargs)

Bases: bob.bio.base.extractor.Extractor

Extracts the Cepstral features

normalize_features(params)[source]
class bob.bio.spear.extractor.CepstralExtended(win_length_ms=20.0, win_shift_ms=10.0, n_filters=40, f_min=0.0, f_max=8000, pre_emphasis_coef=1.0, mel_scale=True, rect_filter=False, inverse_filter=False, delta_win=2, n_ceps=19, dct_norm=False, ssfc_features=False, scfc_features=False, scmc_features=False, with_delta=True, with_delta_delta=True, with_energy=False, normalize_spectrum=False, keep_only_deltas=True, log_filter=True, energy_filter=False, vad_filter='no_filter', normalize_feature_vector=False, **kwargs)

Bases: bob.bio.base.extractor.Extractor

Extract energy bands from spectrogram and VAD labels based on the modulation of the energy around 4 Hz

compute_ceps(rate, data)[source]
normalize_features(features)[source]
class bob.bio.spear.extractor.HTKFeatures(features_mask=array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59]), normalize_flag=True, **kwargs)

Bases: bob.bio.base.extractor.Extractor

Extracts the Cepstral features

HTKReader(input_file)[source]
normalize_features(params)[source]
class bob.bio.spear.extractor.SPROFeatures(features_mask=array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59]), normalize_flag=True, **kwargs)

Bases: bob.bio.base.extractor.Extractor

Extracts the Cepstral features

SPRORead(input_file)[source]
normalize_features(params)[source]