Implementation of Sub-vector quantization. More...
#include <cmd_ln.h>#include <logmath.h>#include "s3types.h"#include "cont_mgau.h"#include "vector.h"Go to the source code of this file.
Classes | |
| struct | subvq_t |
| Wrapper structures of sub-vector quantization. More... | |
Functions | |
| subvq_t * | subvq_init (const char *file, float64 varfloor, int32 max_sv, mgau_model_t *g, cmd_ln_t *config, logmath_t *logmath) |
| void | subvq_free (subvq_t *vq) |
| int32 | subvq_frame_eval (subvq_t *vq, mgau_model_t *g, int32 beam, float32 *feat, int32 *sen_active, int32 *senscr) |
| void | subvq_gautbl_eval_logs3 (subvq_t *vq, float32 *feat, logmath_t *logmath) |
| void | subvq_subvec_eval_logs3 (subvq_t *vq, float32 *feat, int32 sv, logmath_t *logmath) |
| int32 | subvq_mgau_shortlist (subvq_t *vq, int32 m, int32 n, int32 beam) |
| int32 | subvq_mgau_eval (mgau_model_t *g, subvq_t *vq, int32 m, int32 n, int32 *active) |
Implementation of Sub-vector quantization.
| int32 subvq_frame_eval | ( | subvq_t * | vq, |
| mgau_model_t * | g, | ||
| int32 | beam, | ||
| float32 * | feat, | ||
| int32 * | sen_active, | ||
| int32 * | senscr | ||
| ) |
Evaluate senone scores for one frame. If subvq model is available, for each senone, first get approximate Gaussian density scores using it; obtain a shortlist of Gaussians using these scores, then evaluate the shortlist exactly. If no subvq model, evaluate senones using all Gaussian densities. Finally, scale senone scores by subtracting the best.
| vq | In: A sub-vector model |
| g | In: Exact mixture Gaussian model |
| beam | In: (Logs3) threshold for selecting shortlist; range = [-infinity(widest beam), 0(narrowest)] |
| feat | In: Input feature vector for this frame |
| sen_active | In: Active flags for each senone (optional). If not NULL, only active ones evaluated |
| senscr | Out: Normalized senone scores |
| void subvq_free | ( | subvq_t * | vq | ) |
Deallocate sub-vector quantization
| vq | In: A sub-vector model |
| void subvq_gautbl_eval_logs3 | ( | subvq_t * | vq, |
| float32 * | feat, | ||
| logmath_t * | logmath | ||
| ) |
Evaluate the Mahalanobis distances between the given feature vector and each entry in the given subvq codebook. Save results, as logs3 values, in vq->vqdist[][].
| vq | In/Out: Reference subvq structure |
| feat | In: Subvectors extracted from this, and compared to relevant subvq codewords |
Referenced by approx_cont_mgau_ci_eval(), and approx_cont_mgau_frame_eval().
| subvq_t* subvq_init | ( | const char * | file, |
| float64 | varfloor, | ||
| int32 | max_sv, | ||
| mgau_model_t * | g, | ||
| cmd_ln_t * | config, | ||
| logmath_t * | logmath | ||
| ) |
SubVQ file format: VQParam #Original-Codebooks #Original-Codewords/codebook(max) -> #Subvectors #VQ-codewords Subvector 0 length <length> <feature-dim> <feature-dim> <feature-dim> ... Subvector 1 length <length> <feature-dim> <feature-dim> <feature-dim> ... ... Codebook 0 Row 0 of mean/var values (interleaved) for subvector 0 codebook (in 1 line) Row 1 of above Row 2 of above ... Map 0 Mappings for state 0 codewords (in original model) to codewords of this subvector codebook Mappings for state 1 codewords (in original model) to codewords of this subvector codebook Mappings for state 2 codewords (in original model) to codewords of this subvector codebook ... Repeated for each subvector codebook 1 Repeated for each subvector codebook 2 ... End
| file | In: Subvector model file |
| varfloor | In: Floor to be applied to variance values |
| max_sv | In: Use the first so many subvectors instead of all; if <0, use all |
| g | In: Original model from which this subvq model was built, for cross-validation; optional |
| int32 subvq_mgau_eval | ( | mgau_model_t * | g, |
| subvq_t * | vq, | ||
| int32 | m, | ||
| int32 | n, | ||
| int32 * | active | ||
| ) |
Compute the scores of a gaussian using only sum of the sub-vector scores.
| g | In: Gaussian |
| vq | In: the SVQ |
| m | In: GMM Index |
| n | In :#Components in a specified mixture |
| active | In:Active list of mixture |
| int32 subvq_mgau_shortlist | ( | subvq_t * | vq, |
| int32 | m, | ||
| int32 | n, | ||
| int32 | beam | ||
| ) |
| vq | In subvq |
| m | In: GMM index |
| n | In: #Components in specified mixture |
| beam | In: Threshold to select active components |
| void subvq_subvec_eval_logs3 | ( | subvq_t * | vq, |
| float32 * | feat, | ||
| int32 | sv, | ||
| logmath_t * | logmath | ||
| ) |
Evaluate the codewords for a single given subvector sv, wrt the input feature vector. Save results, as logs3 values, in vq->vqdist[sv][]. (Basically, like subvq_gautbl_eval_logs3, but for a single given subvector instead of all.)
| vq | In/Out: Reference subvq structure |
| feat | In: Input feature subvector extracted from this, and compared to relevant codewords |
| sv | In: ID of subvector being evaluated |
1.7.6.1