?? gauss_example_32f_select.txt
字號:
//
// INTEL CORPORATION PROPRIETARY INFORMATION
// This software is supplied under the terms of the license agreement
// or nondisclosure agreement with Intel Corporation and may not be copied
// or disclosed except in accordance with the terms of that agreement.
// Copyright (c) 1999-2006 Intel Corporation. All Rights Reserved.
//
//
Simple program to illustrate vector Gaussian mixture
calculation and feature vectors processing using
partial calculation of Gaussian mixtures (Gaussian
selection algorithm)
Float means, variances, features and probabilities
gauss_main.cpp file
The main program contains several calls of Fake_Decoder_Test function with different
arguments. Probabilities and features calculated while running the test could be
logged (last two arguments).
Fake_Decoder class
Imitates time-synchronous tree decoder requests for state likelihoods (log
probabilities). Each state corresponds to a Gaussian mixtue. Active states and the
length of state activity interval are chosen randomly. Required active states number
is defined for each frame. State activity interval length is uniformly distributed in
[1,max_live]. Probability of the active state is requested for the current frame once
per frame only. The real decoder could request the same probability several times per
frame and could request probabilities for some following frames if acoustic look-ahead
is used.
Fake_Decoder(int state_number, int max_live)
- constructor
~Fake_Decoder(void) - destructor
int Init_Decoder(void) - internal structures initialization
>= 0 if OK, otherwise failed
bool Attach_Cache(Prob_Cache *cache) - attach ready-to-use probability cache
cache state number should not be less
than decoder state number
true if OK, otherwise failed
int Init_LogFile(char *prob_log) - opens log file for probabilities
each probability used by decoder
is written to this file as float value
file is closed in desctuctor
this feature is useful to compare
different modes of probability calculation
>= 0 if OK, otherwise failed
After successful constructor, Init_Decoder and Attach_Cache calls decoder is ready
bool Ready(void) - true if decoder is ready, false otherwise
bool Decode_Frame(int act_num) - process frame with act_num active states
real number of active states could differ
from requested (eg if it was more for
previous frame and no activity intervals
is finished)
true if the frame is not last one
void Close_Decoder(void) - stop decoder and fix statistics
void Get_Statistics(Len_Stat *stat) - extract statistics data: all requests,
repeated requests (0 now), number of
state activity intervals of length [1,256]
int Get_Probability(int state, float *prob) -
request for state probability for current
frame passed to cache and statistics collected
if probability is accessible 0 is returned and
it is written to prob[0]
if probability is not accessible 1 is returned
int Use_Probability(int state, float *prob) -
use of calculated probability (imitation of
calculated probability use in decoder)
0 is returned
int Activity_Interval(int max_len) - random length of state activity interval
Prob_Cache class
Simplified SDT probability cache class. Supplies probabilities for the current frame.
If the value is not in cache up to vec_length values are requested from probability
calculator. Cache has size state_number*vec_length and crawls forward one element per
frame. After frame_num frames it is moved to the beginning.
Prob_Cache(int state_number, int vec_length, int frame_num)
- constructor
~Prob_Cache(void) - destructor
int Init_Cache(void) - internal structures initialization
>= 0 if OK, otherwise failed
bool Attach_Calc(Prob_Calc *calc) - attach ready-to-use probability calculator
cache state number should not be less
than calculator state number
true if OK, otherwise failed
After successful constructor, Init_Cache and Attach_Calc calls cache is ready
bool Ready(void) - true if cache is ready, false otherwise
bool Step_Forward(void) - step to the next frame, values for the
previous frame are lost
true if the next frame exists
void Detach_Calc(void) - detach probability calculator
after successful Attach_Calc cache could
work with other calculator
void Get_Statistics(Len_Stat *stat) - extract statistics data: unused values,
calculated vectors of length [1,vec_length]
float Get_Probability(int state) - request for state probability for current frame
int State_Number(void) - get state number in cache (state_number)
Prob_Calc class
Calculates the vector of Gaussian mixture probabilities. The model consists of
state_number states. Each state corresponds to Gaussian mixture with max_gauss or
less components. Weight, determinant, mean and var values are situated in separate
vectors in the same order. Mean and var vectors are aligned to 16 byte boundary.
Mixture parameters are read from the parameter file or fake calculator is created
(max_gauss components in all mixtures, zero means, identity vars, equal weights,
space_dim dets).
Prob_Calc (Calc_Hint hint) - constructor
hint - method of calculations
calcVect - vector (LogGauss+LogAdd)
calcVecM - vector (LogGauss+Max)
calcMix - mixture (LogGaussMixture)
calcNone - access to data only
calcVecS - vector with Gaussian selection
(LogGaussSelect+LogAdd)
~Prob_Calc(void) - destructor
int Init_Calc(int state_number, int max_gauss, int space_dim, int max_len, int min_len)
int Init_Calc(char* file, int max_len, int min_len)
- internal structures initialization for fake
and file based probability calculator
Mixture parameter file structure is
described in feat_calc.cpp file
Buffer for max_len features is reserved
Vectors of lengt [min_len,max_len] are
calculated (shorter at the utterance end)
>= 0 if OK, otherwise failed
bool Attach_Feat(Feat_Calc *feat) - attach ready-to-use feature producer
feature vector length should be the same as
for calculator
true if OK, otherwise failed
int Init_LogFile(char *feat_log) - opens log file for features
feature vectors really used by probability
calculator are written as HTK feature file
file is closed in desctuctor or while
feature producer detachment
>= 0 if OK, otherwise failed
After successful constructor, Init_Calc and Attach_Feat calls cache is ready
bool Ready(void) - true if calculator is ready, false otherwise
bool Step_Forward(void) - step to the next frame
true if the next frame exists
void Detach_Feat(void) - detach feature producer
after successful Attach_Feat calculator could
work with other producer
int Obv_Prob_Vec(int state, float *result, int len)
- calculate len probabilities from current
frame that are placed to result
less than len values could be calculated if
there are less than len features in the buffer
ot at the end of utterance
features are requested from feature producer
if less than min_len features are in buffer
calculator requests and takes into account
number of partially calculated features due
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -