sv_utils

This module provides miscellaneous tools that might be of use
to the different parts of a speaker recognition engine.

Copyright 2014-2019 Anthony Larcher

sv_utils provides utilities to facilitate the work with SIDEKIT.

sv_utils.check_file_list(input_file_list, file_name_structure)[source]

Check the existence of a list of files in a specific directory Return a new list with the existing segments and a list of indices of those files in the original list. Return outputFileList and idx such that inputFileList[idx] = outputFileList

Parameters
  • input_file_list – list of file names

  • file_name_structure – structure of the filename to search for

Returns

a list of existing files and the indices of the existing files in the input list

sv_utils.clean_stat_server(statserver)[source]
Parameters

statserver

Returns

sv_utils.initialize_iv_extraction_eigen_decomposition(ubm, T)[source]

Estimate matrices Q, D_bar_c and Tnorm, for approximation of the i-vectors. For more information, refers to [Glembeck09]

Parameters
  • ubm – Mixture object, Universal Background Model

  • T – Raw TotalVariability matrix

Returns

Q: Q matrix as described in [Glembeck11] D_bar_c: matrices as described in [Glembeck11] Tnorm: total variability matrix pre-normalized using the co-variance of the UBM

sv_utils.initialize_iv_extraction_fse(ubm, T)[source]

Estimate matrices for approximation of the i-vectors. For more information, refers to [Cumani13]

Parameters
  • ubm – Mixture object, Universal Background Model

  • T – Raw TotalVariability matrix

Returns

Q: Q matrix as described in [Glembeck11] D_bar_c: matrices as described in [Glembeck11] Tnorm: total variability matrix pre-normalized using the co-variance of the UBM

sv_utils.initialize_iv_extraction_weight(ubm, T)[source]

Estimate matrices W and T for approximation of the i-vectors For more information, refers to [Glembeck09]

Parameters
  • ubm – Mixture object, Universal Background Model

  • T – Raw TotalVariability matrix as a ndarray

Returns

W: fix matrix pre-computed using the weights from the UBM and the

total variability matrix

Tnorm: total variability matrix pre-normalized using the co-variance

of the UBM

sv_utils.mean_std_many(features_server, seg_list, in_context=False, num_thread=1)[source]

Compute the mean and standard deviation from a list of segments.

Parameters
  • features_server

  • seg_list – list of file names with start and stop indices

  • in_context

  • num_thread

Returns

a tuple of three values, the number of frames, the mean and the variance

sv_utils.parse_mask(mask)[source]
Parameters

mask

Returns

sv_utils.read_svm(svm_file_name)[source]

Read SVM model in PICKLE format

Parameters

svm_file_name – name of the file to read from

Returns

a tupple of weight and biais

sv_utils.save_svm(svm_file_name, w, b)[source]

Save SVM weights and bias in PICKLE format

Parameters
  • svm_file_name – name of the file to write

  • w – weight coefficients of the SVM to store

  • b – biais of the SVM to store

sv_utils.segment_mean_std_hdf5(input_segment, in_context=False)[source]

Compute the sum and square sum of all features for a list of segments. Input files are in HDF5 format

Parameters
  • input_segment – list of segments to read from, each element of the list is a tuple of 5 values, the filename, the index of thefirst frame, index of the last frame, the number of frames for the left context and the number of frames for the right context

  • in_context

Returns

a tuple of three values, the number of frames, the sum of frames and the sum of squares