Main Page | Class List | Directories | File List | Class Members | File Members

cont_mgau.h File Reference

Interface of full GMM computation with integer value of log likelihood. More...

#include <s3types.h>
#include <logmath.h>

Go to the source code of this file.

Classes

struct  mgau_t
 A single mixture-Gaussian model for one senone (see above comment). More...
struct  mgau_model_t
 The set of mixture-Gaussians in an acoustic model used in Sphinx 3.X family of tool. More...

Defines

#define CONTHMM   10001
#define SEMIHMM   10002
#define FULL_INT_COMP   20001
#define FULL_FLOAT_COMP   20002
#define MIX_INT_FLOAT_COMP   20003
#define MGAU_MEAN   1
#define MGAU_VAR   2
#define MGAU_FULLVAR   3
#define NO_BSTIDX   -1
#define NOT_UPDATED   -100
#define mgau_n_mgau(g)   ((g)->n_mgau)
#define mgau_max_comp(g)   ((g)->max_comp)
#define mgau_veclen(g)   ((g)->veclen)
#define mgau_n_comp(g, m)   ((g)->mgau[m].n_comp)
#define mgau_mean(g, m, c)   ((g)->mgau[m].mean[c])
#define mgau_var(g, m, c)   ((g)->mgau[m].var[c])
#define mgau_fullvar(g, m, c)   ((g)->mgau[m].fullvar[c])
#define mgau_mixw(g, m, c)   ((g)->mgau[m].mixw[c])
#define mgau_mixw_f(g, m, c)   ((g)->mgau[m].mixw_f[c])
#define mgau_lrd(g, m, c)   ((g)->mgau[m].lrd[c])
#define mgau_lrdi(g, m, c)   ((g)->mgau[m].lrdi[c])
#define mgau_frm_sen_eval(g)   ((g)->frm_sen_eval)
#define mgau_frm_gau_eval(g)   ((g)->frm_gau_eval)
#define mgau_frm_cisen_eval(g)   ((g)->frm_ci_sen_eval)
#define mgau_frm_cigau_eval(g)   ((g)->frm_ci_gau_eval)

Functions

S3DECODER_EXPORT mgau_model_tmgau_init (const char *meanfile, const char *varfile, float64 varfloor, const char *mixwfile, float64 mixwfloor, int32 precomp, const char *senmgau, int32 comp_type, logmath_t *logmath)
int32 mgau_var_nzvec_floor (mgau_model_t *g, float64 floor)
S3DECODER_EXPORT int32 mgau_eval (mgau_model_t *g, int32 m, int32 *active_comp, float32 *x, int32 fr, int32 bUpdBstIdx)
S3DECODER_EXPORT int32 mgau_comp_eval (mgau_model_t *g, int32 m, float32 *x, int32 *score)
int32 mgau_dump (mgau_model_t *g, int32 type)
S3DECODER_EXPORT void mgau_free (mgau_model_t *g)
S3DECODER_EXPORT int32 mgau_mean_reload (mgau_model_t *g, const char *mean_file_name)
S3DECODER_EXPORT int32 mgau_var_reload (mgau_model_t *g, const char *var_file_name)
int32 mgau_precomp (mgau_model_t *g)


Detailed Description

Interface of full GMM computation with integer value of log likelihood.


Define Documentation

#define CONTHMM   10001
 

Specification of sets of GMM

#define FULL_FLOAT_COMP   20002
 

#define FULL_INT_COMP   20001
 

#define mgau_frm_cigau_eval  )     ((g)->frm_ci_gau_eval)
 

#define mgau_frm_cisen_eval  )     ((g)->frm_ci_sen_eval)
 

#define mgau_frm_gau_eval  )     ((g)->frm_gau_eval)
 

#define mgau_frm_sen_eval  )     ((g)->frm_sen_eval)
 

#define mgau_fullvar g,
m,
 )     ((g)->mgau[m].fullvar[c])
 

#define MGAU_FULLVAR   3
 

#define mgau_lrd g,
m,
 )     ((g)->mgau[m].lrd[c])
 

#define mgau_lrdi g,
m,
 )     ((g)->mgau[m].lrdi[c])
 

#define mgau_max_comp  )     ((g)->max_comp)
 

#define mgau_mean g,
m,
 )     ((g)->mgau[m].mean[c])
 

#define MGAU_MEAN   1
 

#define mgau_mixw g,
m,
 )     ((g)->mgau[m].mixw[c])
 

#define mgau_mixw_f g,
m,
 )     ((g)->mgau[m].mixw_f[c])
 

#define mgau_n_comp g,
 )     ((g)->mgau[m].n_comp)
 

#define mgau_n_mgau  )     ((g)->n_mgau)
 

Access number of GMMs mgau_max_comp Access the maximum number of components. It can be different across GMMs mgau_veclen Access an integer array contains the size of each stream mgau_n_comp Access the number of component for a particular mixture in a GMM mgau_mean Access the mean mgau_var Access the variance mgau_lrd Access the floating point version of the Gaussian constant mgau_lrd Access the integer version of the Gaussian constant mgau_frm_sen_eval Number of senones evaluated in this frame mgau_frm_gau_eval Number of gaussians evaluated in this frame mgau_frm_ci_sen_eval Number of CI senones evaluated in this frame mgau_frm_ci_gau_eval Number of CI gaussians evaluated in this frame

#define mgau_var g,
m,
 )     ((g)->mgau[m].var[c])
 

#define MGAU_VAR   2
 

#define mgau_veclen  )     ((g)->veclen)
 

#define MIX_INT_FLOAT_COMP   20003
 

#define NO_BSTIDX   -1
 

#define NOT_UPDATED   -100
 

#define SEMIHMM   10002
 


Function Documentation

S3DECODER_EXPORT int32 mgau_comp_eval mgau_model_t g,
int32  m,
float32 *  x,
int32 *  score
 

Out: Array of scores for each component

Parameters:
g  In: Set of mixture Gaussians
m  In: Mixture being considered
x  In: Input vector being compared to the components

int32 mgau_dump mgau_model_t g,
int32  type
 

A routine that dump all mean and variance parameters of a set of gaussian distribution.

Returns:
always 0
Parameters:
g  In: Set of mixture Gaussians
type  In: type of output, MGAU_MEAN for mean or MGAU_VAR for variance.

S3DECODER_EXPORT int32 mgau_eval mgau_model_t g,
int32  m,
int32 *  active,
float32 *  x,
int32  fr,
int32  update_best_id
 

Compute the log likelihood of a Gaussian mixture model in fixed-point. Notice that within the program, the Gaussian distribution is computed using floating point. But log-add is done in fixed point (usually by table lookup).

Parameters:
g  In: The entire mixture Gaussian model
m  In: The chosen mixture in the model (i.e., g->mgau[m])
active  In: An optional, -1 terminated list of active component indices; if non-NULL, only the specified components are used in the evaluation.
x  In: Input observation vector (of length g->veclen).
fr  In: Frame number where GMM m is updated
update_best_id  In: Whether the best index for the GMM will be updated or not

S3DECODER_EXPORT void mgau_free mgau_model_t g  ) 
 

ARCHAN, I noticed this program because of Ricky's comment. In 2004, a very useful tool called valgrind started to be available for Linux. This tool allows me to pick up a lot of memory problems easily.

Parameters:
g  In: A set of model to free

S3DECODER_EXPORT mgau_model_t* mgau_init const char *  meanfile,
const char *  varfile,
float64  varfloor,
const char *  mixwfile,
float64  mixwfloor,
int32  precomp,
const char *  senmgau,
int32  comp_type,
logmath_t *  logmath
 

At the moment, S3 models have the same # of means in each codebook and 1 var/mean

Parameters:
meanfile  In: File containing means of mixture gaussians
varfile  In: File containing variances of mixture gaussians
varfloor  In: Floor value applied to variances; e.g., 0.0001
mixwfile  In: File containing mixture weights
mixwfloor  In: Floor value for mixture weights; e.g., 0.0000001
precomp  In: If TRUE, create and precompute mgau_t.lrd and also transform each var value to 1/(2*var). (If FALSE, one cannot use the evaluation routines provided here.)
senmgau  In: type of the gaussians distribution, .cont. or .semi. FIX me! This is confusing!
comp_type  In: Type of computation in this set of gaussian mixtures.

S3DECODER_EXPORT int32 mgau_mean_reload mgau_model_t g,
const char *  mean_file_name
 

reload the mean file

Parameters:
g  In/Out: The GMM
mean_file_name  In: file name for the mean file.

int32 mgau_precomp mgau_model_t g  ) 
 

Some of the Mahalanobis distance computation (between Gaussian density means and given vectors) can be carried out in advance. (See comment in .h file.)

int32 mgau_var_nzvec_floor mgau_model_t g,
float64  floor
 

Floor any variance vector that is non-zero (vector).

Returns:
No. of variance VALUES floored.
Parameters:
g  In: A mixture of Gaussian components
floor  In: The floor value

S3DECODER_EXPORT int32 mgau_var_reload mgau_model_t g,
const char *  var_file_name
 

reload the mean file

Parameters:
g  In/Out: The GMM
var_file_name  In: file name for the mean file.


Generated on Sat Apr 11 00:02:29 2009 by  doxygen 1.3.9.1