libsent/include/sent/hmm_calc.h

音響尤度計算用ワークエリアとキャッシュ [詳細]

#include <sent/stddefs.h>
#include <sent/htk_hmm.h>
#include <sent/htk_param.h>

ソースコードを見る。

データ構造

struct  MIXCACHE
 A component of per-codebook probability cache while search [詳細]
struct  HMMWork
 Work area and cache for HMM computation [詳細]

マクロ定義

#define TMBEAMWIDTH   5.0
 Score beam offset for GPRUNE_SEL_BEAM.

列挙型

enum  {
  GPRUNE_SEL_UNDEF, GPRUNE_SEL_NONE, GPRUNE_SEL_SAFE, GPRUNE_SEL_HEURISTIC,
  GPRUNE_SEL_BEAM
}
 Symbols to specify which Gaussian pruning algorithm to use. [詳細]

関数

void make_log_tbl ()
 Generate a value tables of $\log (1+e^x)$.
LOGPROB addlog (LOGPROB x, LOGPROB y)
 Rapid computation of $\log (e^x + e^y)$.
LOGPROB addlog_array (LOGPROB *x, int n)
 Rapid computation of $\log (\sum_{i=1}^N e^{x_i})$.
boolean outprob_init (HMMWork *wrk, HTK_HMM_INFO *hmminfo, HTK_HMM_INFO *gshmm, int gms_num, int gprune_method, int gprune_mixnum)
 Initialize and setup acoustic computation functions.
boolean outprob_prepare (HMMWork *wrk, int framenum)
 Prepare for the next input of given frame length.
void outprob_free (HMMWork *wrk)
 Free all work area for outprob computation.
boolean outprob_cache_init (HMMWork *wrk)
 Initialize the cache data, should be called once on startup.
boolean outprob_cache_prepare (HMMWork *wrk)
 Prepare cache for the next input, by clearing the existing cache.
void outprob_cache_free (HMMWork *wrk)
 Free work area for cache.
LOGPROB outprob_state (HMMWork *wrk, int t, HTK_HMM_State *stateinfo, HTK_Param *param)
 Compute output probability of a state.
void outprob_cd_nbest_init (HMMWork *wrk, int num)
 Initialize work area for outprob_cd_nbest().
void outprob_cd_nbest_free (HMMWork *wrk)
 Free work area for outprob_cd_nbest().
LOGPROB outprob_cd (HMMWork *wrk, int t, CD_State_Set *lset, HTK_Param *param)
 Compute the log output probability of a pseudo state set.
boolean gms_init (HMMWork *wrk)
 Initialize the GMS related functions and data.
boolean gms_prepare (HMMWork *wrk, int framelen)
 Setup GMS parameters for next input.
void gms_free (HMMWork *wrk)
 Free GMS related work areas.
LOGPROB gms_state (HMMWork *wrk)
 Get HMM State probability of current state with Gaussiam Mixture Selection.
void gms_gprune_init (HMMWork *wrk)
 Initialization of GMS HMM likelihood computation.
void gms_gprune_prepare (HMMWork *wrk)
 Prepare GMS HMM computation for the next speech input.
void gms_gprune_free (HMMWork *wrk)
 Free GMS related work area.
void compute_gs_scores (HMMWork *wrk)
 Main function to compute all the GMS HMM states in a frame with the input vectore specified by OP_vec.
LOGPROB calc_mix (HMMWork *wrk)
 Compute the output probability of current state OP_State.
boolean calc_tied_mix_init (HMMWork *wrk)
 Initialize codebook cache area.
boolean calc_tied_mix_prepare (HMMWork *wrk, int framenum)
 Setup codebook cache for the next incoming input.
void calc_tied_mix_free (HMMWork *wrk)
 Free work area for tied-mixture calculation.
LOGPROB calc_tied_mix (HMMWork *wrk)
 Compute the output probability of current state OP_State on tied-mixture model
int cache_push (HMMWork *wrk, int id, LOGPROB score, int len)
 Store a score to the current list of computed Gaussians.
LOGPROB compute_g_base (HMMWork *wrk, HTK_HMM_Dens *binfo)
 Calculate probability of a Gaussian density against input vector on OP_vec.
boolean gprune_none_init (HMMWork *wrk)
 Initialize and setup work area for Gaussian computation
void gprune_none_free (HMMWork *wrk)
 Free gprune_none related work area.
void gprune_none (HMMWork *wrk, HTK_HMM_Dens **g, int num, int *last_id)
 Compute a set of Gaussians with no pruning
LOGPROB compute_g_safe (HMMWork *wrk, HTK_HMM_Dens *binfo, LOGPROB thres)
 Calculate probability with safe pruning.
boolean gprune_safe_init (HMMWork *wrk)
 Initialize and setup work area for Gaussian pruning by safe algorithm.
void gprune_safe_free (HMMWork *wrk)
 Free gprune_safe related work area.
void gprune_safe (HMMWork *wrk, HTK_HMM_Dens **g, int gnum, int *last_id)
 Compute a set of Gaussians with safe pruning.
boolean gprune_heu_init (HMMWork *wrk)
 Initialize and setup work area for Gaussian pruning by heuristic algorithm.
void gprune_heu_free (HMMWork *wrk)
 Free gprune_heu related work area.
void gprune_heu (HMMWork *wrk, HTK_HMM_Dens **g, int gnum, int *last_id)
 Compute a set of Gaussians with heuristic pruning.
boolean gprune_beam_init (HMMWork *wrk)
 Initialize and setup work area for Gaussian pruning by beam algorithm.
void gprune_beam_free (HMMWork *wrk)
 Free gprune_beam related work area.
void gprune_beam (HMMWork *wrk, HTK_HMM_Dens **g, int gnum, int *last_id)
 Compute a set of Gaussians with beam pruning.


説明

音響尤度計算用ワークエリアとキャッシュ

作者:
Akinobu LEE
日付:
Thu Feb 10 14:54:06 2005
Revision
1.2

hmm_calc.h で定義されています。


マクロ定義

#define TMBEAMWIDTH   5.0

Score beam offset for GPRUNE_SEL_BEAM.

Larger value may ease pruning error, but processing may become slower. Smaller value can speed up the acoustic computation, but may cause error.

hmm_calc.h の 52 行で定義されています。

参照元 set_dimthres().


列挙型

anonymous enum

Symbols to specify which Gaussian pruning algorithm to use.

hmm_calc.h の 43 行で定義されています。


関数

void make_log_tbl (  ) 

Generate a value tables of $\log (1+e^x)$.

$x$ is from 0 to (- VRANGE), and table size is TBLSIZE.

addlog.c の 42 行で定義されています。

参照元 outprob_init().

LOGPROB addlog ( LOGPROB  x,
LOGPROB  y 
)

Rapid computation of $\log (e^x + e^y)$.

If value differs more than LOG_ADDMIN, the larger value will be returned as is.

引数:
x [in] log value
y [in] log value
戻り値:
result value.

addlog.c の 71 行で定義されています。

LOGPROB addlog_array ( LOGPROB *  a,
int  n 
)

Rapid computation of $\log (\sum_{i=1}^N e^{x_i})$.

引数:
a [in] array of log values
n [in] length of above
戻り値:
the result value.

addlog.c の 103 行で定義されています。

参照元 calc_mix(), calc_tied_mix(), と gmm_calc_mix().

boolean outprob_init ( HMMWork *  wrk,
HTK_HMM_INFO *  hmminfo,
HTK_HMM_INFO *  gshmm,
int  gms_num,
int  gprune_method,
int  gprune_mixnum 
)

Initialize and setup acoustic computation functions.

引数:
wrk [i/o] HMM computation work area
hmminfo [in] HMM definition
gshmm [in] GMS HMM definition if exist, or NULL if not
gms_num [in] number of GMS HMM to compute (valid if gshmm != NULL)
gprune_method [in] gaussian pruning method
gprune_mixnum [in] number of pdf to compute at a codebook in gaussian pruning
戻り値:
TRUE on success, FALSE on failure.

select functions

outprob_init.c の 68 行で定義されています。

参照元 j_final_fusion().

boolean outprob_prepare ( HMMWork *  wrk,
int  framenum 
)

Prepare for the next input of given frame length.

引数:
wrk [i/o] HMM computation work area
framenum [in] input length in frame.
戻り値:
TRUE on success, FALSE on failure.

outprob_init.c の 166 行で定義されています。

参照元 get_back_trellis(), RealTimePipeLine(), と reset_mfcc().

void outprob_free ( HMMWork *  wrk  ) 

Free all work area for outprob computation.

引数:
wrk [i/o] HMM computation work area

outprob_init.c の 187 行で定義されています。

参照元 j_process_am_free().

boolean outprob_cache_init ( HMMWork *  wrk  ) 

Initialize the cache data, should be called once on startup.

引数:
wrk [i/o] HMM computation work area
戻り値:
TRUE on success, FALSE on failure.

outprob.c の 78 行で定義されています。

参照元 outprob_init().

boolean outprob_cache_prepare ( HMMWork *  wrk  ) 

Prepare cache for the next input, by clearing the existing cache.

引数:
wrk [i/o] HMM computation work area
戻り値:
TRUE on success, FALSE on failure.

outprob.c の 96 行で定義されています。

参照元 outprob_prepare().

void outprob_cache_free ( HMMWork *  wrk  ) 

Free work area for cache.

引数:
wrk [i/o] HMM computation work area

outprob.c の 158 行で定義されています。

参照元 outprob_free().

LOGPROB outprob_state ( HMMWork *  wrk,
int  t,
HTK_HMM_State *  stateinfo,
HTK_Param *  param 
)

Compute output probability of a state.

Set the needed values to the global variables that begins with "OP_", and call calc_outprob_state(). The calc_outprob_state() is actually a function pointer, and the entity is either calc_tied_mix() for tied-mixture model and calc_mix() for others. (If you use GMS, the entity will be gms_state() instead.)

The state-level cache is also consulted here.

引数:
wrk [i/o] HMM computation work area
t [in] time frame
stateinfo [in] state information to compute the output probability
param [in] input parameter vectors
戻り値:
output log probability.

outprob.c の 184 行で定義されています。

参照元 next_word(), outprob(), outprob_cd_avg(), outprob_cd_max(), outprob_cd_nbest(), と start_word().

void outprob_cd_nbest_init ( HMMWork *  wrk,
int  num 
)

Initialize work area for outprob_cd_nbest().

引数:
wrk [i/o] HMM computation work area
num [in] number of top states to be calculated.

outprob.c の 219 行で定義されています。

参照元 outprob_init().

void outprob_cd_nbest_free ( HMMWork *  wrk  ) 

Free work area for outprob_cd_nbest().

引数:
wrk [i/o] HMM computation work area

outprob.c の 232 行で定義されています。

参照元 outprob_free().

LOGPROB outprob_cd ( HMMWork *  wrk,
int  t,
CD_State_Set *  lset,
HTK_Param *  param 
)

Compute the log output probability of a pseudo state set.

引数:
wrk [i/o] HMM computation work area
t [in] input frame
lset [in] pseudo state set
param [in] input parameter data
戻り値:
the computed log output probability.

outprob.c の 344 行で定義されています。

参照元 next_word(), outprob(), と start_word().

boolean gms_init ( HMMWork *  wrk  ) 

Initialize the GMS related functions and data.

引数:
wrk [i/o] HMM computation work area
戻り値:
TRUE on success, FALSE on failure.

gms.c の 283 行で定義されています。

参照元 outprob_init().

boolean gms_prepare ( HMMWork *  wrk,
int  framenum 
)

Setup GMS parameters for next input.

引数:
wrk [i/o] HMM computation work area
framenum [in] length of next input in frames
戻り値:
TRUE on success, FALSE on failure.

gms.c の 330 行で定義されています。

参照元 outprob_prepare().

void gms_free ( HMMWork *  wrk  ) 

Free GMS related work areas.

引数:
wrk [i/o] HMM computation work area

gms.c の 366 行で定義されています。

参照元 outprob_free().

LOGPROB gms_state ( HMMWork *  wrk  ) 

Get HMM State probability of current state with Gaussiam Mixture Selection.

If the GMS HMM score of the corresponding basephone is below the N-best, the triphone score will not be computed, and the score of the GMS HMM will be returned instead as a fallback score. Else, the precise triphone will be computed and returned.

引数:
wrk [i/o] HMM computation work area
戻り値:
the state output probability score in log10.

gms.c の 394 行で定義されています。

参照元 outprob_init().

void gms_gprune_init ( HMMWork *  wrk  ) 

Initialization of GMS HMM likelihood computation.

引数:
wrk [i/o] HMM computation work area

gms_gprune.c の 43 行で定義されています。

参照元 gms_init().

void gms_gprune_prepare ( HMMWork *  wrk  ) 

Prepare GMS HMM computation for the next speech input.

引数:
wrk [i/o] HMM computation work area

gms_gprune.c の 55 行で定義されています。

参照元 gms_prepare().

void gms_gprune_free ( HMMWork *  wrk  ) 

Free GMS related work area.

引数:
wrk [i/o] HMM computation work area

gms_gprune.c の 70 行で定義されています。

参照元 gms_free().

void compute_gs_scores ( HMMWork *  wrk  ) 

Main function to compute all the GMS HMM states in a frame with the input vectore specified by OP_vec.

This function assumes that this will be called for sequencial frame, since it utilizes the result of previous frame for faster pruning.

引数:
wrk [i/o] HMM computation work area

gms_gprune.c の 202 行で定義されています。

参照元 do_gms().

LOGPROB calc_mix ( HMMWork *  wrk  ) 

Compute the output probability of current state OP_State.

No codebook-level cache is done.

引数:
wrk [i/o] HMM computation work area
戻り値:
the output probability of the state OP_State in log10

calc_mix.c の 41 行で定義されています。

参照元 outprob_init().

boolean calc_tied_mix_init ( HMMWork *  wrk  ) 

Initialize codebook cache area.

引数:
wrk [i/o] HMM computation work area
戻り値:
TRUE on success, FALSE on failure.

calc_tied_mix.c の 51 行で定義されています。

参照元 outprob_init().

boolean calc_tied_mix_prepare ( HMMWork *  wrk,
int  framenum 
)

Setup codebook cache for the next incoming input.

引数:
wrk [i/o] HMM computation work area
framenum [in] length of the next input.
戻り値:
TRUE on success, FALSE on failure.

calc_tied_mix.c の 69 行で定義されています。

参照元 outprob_prepare().

void calc_tied_mix_free ( HMMWork *  wrk  ) 

Free work area for tied-mixture calculation.

引数:
wrk [i/o] HMM computation work area

calc_tied_mix.c の 133 行で定義されています。

参照元 outprob_free().

LOGPROB calc_tied_mix ( HMMWork *  wrk  ) 

Compute the output probability of current state OP_State on tied-mixture model

This function assumes that the OP_state is assigned to a tied-mixture codebook. Here the output probability of Gaussian mixture component referred by OP_state is consulted to the book level cache, and if not computed yet on that input frame time, it will be computed here.

引数:
wrk [i/o] HMM computation work area
戻り値:
the computed output probability in log10.

calc_tied_mix.c の 154 行で定義されています。

参照元 outprob_init().

int cache_push ( HMMWork *  wrk,
int  id,
LOGPROB  score,
int  len 
)

Store a score to the current list of computed Gaussians.

Store the calculated score of a Gaussian to OP_calced_score, with its corresponding mixture id to OP_calced_id.

The OP_calced_score and OP_calced_id always holds the (OP_gprune_num)-best scores and ids. If the number of stored Gaussian from start has reached OP_gprune_num and the given score is below the bottom, it will be dropped. Else, the new score will be inserted and the bottom will be dropped from the list.

The OP_calced_score will always kept sorted by the scores.

引数:
wrk [i/o] HMM computation work area
id [in] mixture id of the Gaussian to store
score [in] score of the Gaussian to store
len [in] current number of stored scores in OP_calced_score
戻り値:
the resulting number of stored scores in OP_calced_score.

gprune_common.c の 88 行で定義されています。

参照元 gprune_beam(), gprune_heu(), と gprune_safe().

LOGPROB compute_g_base ( HMMWork *  wrk,
HTK_HMM_Dens *  binfo 
)

Calculate probability of a Gaussian density against input vector on OP_vec.

引数:
wrk [i/o] HMM computation work area
binfo [in] a Gaussian density
戻り値:
the output log probability.

gprune_none.c の 59 行で定義されています。

参照元 gprune_beam(), gprune_heu(), gprune_none(), と gprune_safe().

boolean gprune_none_init ( HMMWork *  wrk  ) 

Initialize and setup work area for Gaussian computation

引数:
wrk [i/o] HMM computation work area
戻り値:
TRUE on success, FALSE on failure.

gprune_none.c の 86 行で定義されています。

参照元 outprob_init().

void gprune_none_free ( HMMWork *  wrk  ) 

Free gprune_none related work area.

引数:
wrk [i/o] HMM computation work area

gprune_none.c の 104 行で定義されています。

参照元 outprob_init().

void gprune_none ( HMMWork *  wrk,
HTK_HMM_Dens **  g,
int  num,
int *  last_id 
)

Compute a set of Gaussians with no pruning

The calculated scores will be stored to OP_calced_score, with its corresponding mixture id to OP_calced_id. The number of calculated mixtures is also stored in OP_calced_num.

This can be called from calc_tied_mix() or calc_mix().

引数:
wrk [i/o] HMM computation work area
g [in] set of Gaussian densities to compute the output probability.
num [in] length of above
last_id [in] ID list of N-best mixture in previous input frame, or NULL if not exist

gprune_none.c の 126 行で定義されています。

参照元 outprob_init().

LOGPROB compute_g_safe ( HMMWork *  wrk,
HTK_HMM_Dens *  binfo,
LOGPROB  thres 
)

Calculate probability with safe pruning.

Calculate probability of a Gaussian toward OP_vec, performing pruning using the scholar threshold.

引数:
wrk [i/o] HMM computation work area
binfo [in] Gaussian density
thres [in] threshold
戻り値:
the output log probability.

gprune_safe.c の 76 行で定義されています。

参照元 gprune_beam(), gprune_heu(), と gprune_safe().

boolean gprune_safe_init ( HMMWork *  wrk  ) 

Initialize and setup work area for Gaussian pruning by safe algorithm.

引数:
wrk [i/o] HMM computation work area
戻り値:
TRUE on success, FALSE on failure.

gprune_safe.c の 107 行で定義されています。

参照元 outprob_init().

void gprune_safe_free ( HMMWork *  wrk  ) 

Free gprune_safe related work area.

引数:
wrk [i/o] HMM computation work area

gprune_safe.c の 127 行で定義されています。

参照元 outprob_init().

void gprune_safe ( HMMWork *  wrk,
HTK_HMM_Dens **  g,
int  gnum,
int *  last_id 
)

Compute a set of Gaussians with safe pruning.

If the N-best mixtures in the previous frame is specified in last_id, They are first computed to set the initial threshold. After that, the rest of the Gaussians will be computed with the thresholds to drop unpromising Gaussians from computation at early stage of likelihood computation. If the computation of a Gaussian reached to the end, the threshold will be updated to always hold the likelihood of current N-best score.

The calculated scores will be stored to OP_calced_score, with its corresponding mixture id to OP_calced_id. These are done by calling cache_push(). The number of calculated mixtures is also stored in OP_calced_num.

This can be called from calc_tied_mix() or calc_mix().

引数:
wrk [i/o] HMM computation work area
g [in] set of Gaussian densities to compute the output probability
gnum [in] length of above
last_id [in] ID list of N-best mixture in previous input frame, or NULL if not exist

gprune_safe.c の 159 行で定義されています。

参照元 outprob_init().

boolean gprune_heu_init ( HMMWork *  wrk  ) 

Initialize and setup work area for Gaussian pruning by heuristic algorithm.

引数:
wrk [i/o] HMM computation work area
戻り値:
TRUE on success, FALSE on failure.

gprune_heu.c の 237 行で定義されています。

参照元 outprob_init().

void gprune_heu_free ( HMMWork *  wrk  ) 

Free gprune_heu related work area.

引数:
wrk [i/o] HMM computation work area

gprune_heu.c の 259 行で定義されています。

参照元 outprob_init().

void gprune_heu ( HMMWork *  wrk,
HTK_HMM_Dens **  g,
int  gnum,
int *  last_id 
)

Compute a set of Gaussians with heuristic pruning.

If the N-best mixtures in the previous frame is specified in last_id, They are first computed to get the maximum value for each dimension. After that, the rest of the Gaussians will be computed using the maximum values as heuristics of uncomputed dimensions to drop unpromising Gaussians from computation at early stage of likelihood computation. If the last_id is not specified (typically at the first frame of the input), a safe pruning as same as one in gprune_safe.c will be applied.

The calculated scores will be stored to OP_calced_score, with its corresponding mixture id to OP_calced_id. These are done by calling cache_push(). The number of calculated mixtures is also stored in OP_calced_num.

This can be called from calc_tied_mix() or calc_mix().

引数:
wrk [i/o] HMM computation work area
g [in] set of Gaussian densities to compute the output probability
gnum [in] length of above
last_id [in] ID list of N-best mixture in previous input frame, or NULL if not exist

gprune_heu.c の 293 行で定義されています。

参照元 outprob_init().

boolean gprune_beam_init ( HMMWork *  wrk  ) 

Initialize and setup work area for Gaussian pruning by beam algorithm.

引数:
wrk [i/o] HMM computation work area
戻り値:
TRUE on success, FALSE on failure.

gprune_beam.c の 234 行で定義されています。

参照元 outprob_init().

void gprune_beam_free ( HMMWork *  wrk  ) 

Free gprune_beam related work area.

引数:
wrk [i/o] HMM computation work area

gprune_beam.c の 256 行で定義されています。

参照元 outprob_init().

void gprune_beam ( HMMWork *  wrk,
HTK_HMM_Dens **  g,
int  gnum,
int *  last_id 
)

Compute a set of Gaussians with beam pruning.

If the N-best mixtures in the previous frame is specified in last_id, They are first computed to set the thresholds for each dimension. After that, the rest of the Gaussians will be computed with those dimension thresholds to drop unpromising Gaussians from computation at early stage of likelihood computation. If the last_id is not specified (typically at the first frame of the input), a safe pruning as same as one in gprune_safe.c will be applied.

The calculated scores will be stored to OP_calced_score, with its corresponding mixture id to OP_calced_id. These are done by calling cache_push(). The number of calculated mixtures is also stored in OP_calced_num.

This can be called from calc_tied_mix() or calc_mix().

引数:
wrk [i/o] HMM computation work area
g [in] set of Gaussian densities to compute the output probability
gnum [in] length of above
last_id [in] ID list of N-best mixture in previous input frame, or NULL if not exist

gprune_beam.c の 289 行で定義されています。

参照元 outprob_init().


Juliusに対してTue Dec 18 16:05:02 2007に生成されました。  doxygen 1.5.4