Implementation detail of full GMM computation with integer value of log likelihood. More...
#include <string.h>#include <math.h>#include "bio.h"#include "vector.h"#include "matrix.h"#include "logs3.h"#include "cont_mgau.h"Defines | |
| #define | MGAU_PARAM_VERSION "1.0" |
| #define | MGAU_MIXW_VERSION "1.0" |
Functions | |
| int32 | mgau_mean_reload (mgau_model_t *g, const char *mean_file_name) |
| int32 | mgau_dump (mgau_model_t *g, int32 type) |
| int32 | mgau_var_nzvec_floor (mgau_model_t *g, float64 floor) |
| 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) |
| int32 | mgau_comp_eval (mgau_model_t *g, int32 s, float32 *x, int32 *score) |
| int32 | mgau_eval (mgau_model_t *g, int32 m, int32 *active, float32 *x, int32 fr, int32 update_best_id) |
| void | mgau_free (mgau_model_t *g) |
Implementation detail of full GMM computation with integer value of log likelihood.
| #define MGAU_MIXW_VERSION "1.0" |
| #define MGAU_PARAM_VERSION "1.0" |
| int32 mgau_comp_eval | ( | mgau_model_t * | g, | |
| int32 | s, | |||
| float32 * | x, | |||
| int32 * | score | |||
| ) |
Like mgau_eval(), but return the scores of the individual components, instead of combining them into a senone score.
| g | In: Set of mixture Gaussians | |
| s | In: Mixture being considered | |
| x | In: Input vector being compared to the components | |
| score | Out: Array of scores for each component |
References mgau_model_t::distfloor, mgau_model_t::logmath, mgau_t::lrd, mgau_t::mean, mgau_model_t::mgau, mgau_veclen, mgau_t::n_comp, and mgau_t::var.
| int32 mgau_dump | ( | mgau_model_t * | g, | |
| int32 | type | |||
| ) |
A routine that dump all mean and variance parameters of a set of gaussian distribution.
| g | In: Set of mixture Gaussians | |
| type | In: type of output, MGAU_MEAN for mean or MGAU_VAR for variance. |
References mgau_t::mean, mgau_model_t::mgau, MGAU_MEAN, mgau_n_comp, mgau_n_mgau, MGAU_VAR, mgau_veclen, and mgau_t::var.
| 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).
| 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 |
References mgau_t::bstidx, mgau_t::bstscr, mgau_model_t::comp_type, mgau_model_t::distfloor, mgau_model_t::logmath, mgau_model_t::mgau, mgau_veclen, MIX_INT_FLOAT_COMP, NO_BSTIDX, S3_LOGPROB_ZERO, and mgau_t::updatetime.
Referenced by approx_cont_mgau_ci_eval(), and approx_cont_mgau_frame_eval().
| 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.
| g | In: A set of model to free |
References mgau_t::fullvar, mgau_t::lrd, mgau_t::mean, mgau_model_t::mgau, mgau_t::mixw, mgau_t::mixw_f, and mgau_t::var.
Referenced by main().
| 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
| 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. |
References mgau_model_t::comp_type, CONTHMM, mgau_model_t::distfloor, FULL_FLOAT_COMP, FULL_INT_COMP, mgau_model_t::gau_type, mgau_model_t::logmath, mgau_model_t::mgau, MGAU_MEAN, MGAU_VAR, MIX_INT_FLOAT_COMP, S3_LOGPROB_ZERO, S3_LOGPROB_ZERO_F, SEMIHMM, mgau_t::var, and mgau_model_t::verbose.
Referenced by main().
| int32 mgau_mean_reload | ( | mgau_model_t * | g, | |
| const char * | mean_file_name | |||
| ) |
reload the mean file
| g | In/Out: The GMM | |
| mean_file_name | In: file name for the mean file. |
References mgau_model_t::mgau, and MGAU_MEAN.
| int32 mgau_var_nzvec_floor | ( | mgau_model_t * | g, | |
| float64 | floor | |||
| ) |
Floor any variance vector that is non-zero (vector).
| g | In: A mixture of Gaussian components | |
| floor | In: The floor value |
References mgau_model_t::mgau, mgau_n_comp, mgau_n_mgau, mgau_veclen, mgau_t::var, vector_is_zero(), and mgau_model_t::verbose.
1.6.1