segDecoder.h File Reference

Header file for generic Viterbi-type Segmental-HMM decoder. More...

#include "segSyntax.h"

Go to the source code of this file.

Data Structures

struct  segDpItem
 structure to store decoding results for each node, which are used during trace-back More...
struct  segPruningParameter
 pruning parameters More...
struct  segDecoderParameter
 decoder parameters More...

Defines

#define VOID   -1
 special value for path pointers of node in trellis
#define NO_PRUN   0
 no specified pruning method
#define THRESH_PRUN   1
 beam pruning with probability threshold
#define N_BEST_PRUN   2
 N best nodes to be maintained.

Typedefs

typedef segDpItem SEG_DP_ITEM
 structure to store decoding results for each node, which are used during trace-back
typedef segPruningParameter SEG_PRUN_PARAM
 pruning parameters
typedef segDecoderParameter SEG_DEC_PARAM
 decoder parameters

Functions

double segViterbiDecoder (SEG_DP_ITEM ***, SEG_SYNTAX *, double **, int *, int, int, int, SEG_DEC_PARAM *)
 Generic Viterbi-type decorder for segmental HMMs.
int * segRecoverStateSeq (int *, SEG_DP_ITEM **, SEG_SYNTAX *, int)
 Recover the optimal state sequence from the path record of node.
SEG_ANN_DATAsegRecoverRecogSeq (SEG_DP_ITEM **, SEG_SYNTAX *, int, int)
 Recover the model labels and their start and end times.
SEG_STATE ** segRecoverStateIds (int *, SEG_SYNTAX *, int)
 Recover the sequence of state identities from a state sequence.
int segGetDurationLimits (int *, int *, SEG_MODEL_SET *, SEG_SYNTAX *, int)
 Find the minimum and maximum possible durations for a given syntax.
int segFreeDecoder (SEG_DP_ITEM **, int)
 Free memory space storing all the paths in the trellis.
void segFreeStateSeq (int *)
 Free memory space of state sequence.


Detailed Description

Header file for generic Viterbi-type Segmental-HMM decoder.

Date:
21.06.2007 (revised)
Author:
Yoshinori Shiga, Centre for Vision, Speech and Signal Processing, University of Surrey
Revision

Function Documentation

int segFreeDecoder ( SEG_DP_ITEM **  dpHist,
int  numStates 
)

Free memory space storing all the paths in the trellis.

Parameters:
[in] dpHist Paths in the trellis for back-tracing
[in] numStates Number of states
Return values:
NO_ERROR Successful execution
Author:
Yoshinori Shiga @ CVSSP, University of Surrey

void segFreeStateSeq ( int *  stateSeq  ) 

Free memory space of state sequence.

Parameters:
[in] stateSeq State (index) sequence
Returns:
No return value
Author:
Yoshinori Shiga @ CVSSP, University of Surrey

int segGetDurationLimits ( int *  minUttDur,
int *  maxUttDur,
SEG_MODEL_SET models,
SEG_SYNTAX synt,
int  eStates 
)

Find the minimum and maximum possible durations for a given syntax.

Parameters:
[in] minUttDur Minimum utterance duration
[in] maxUttDur Maximum utterance duration
[in] models Model set
[in] synt Syntax
[in] eStates Number of emitting states in the syntax
Return values:
RTN_ERROR Inconsistency in the models
NO_ERROR Successfully executed
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function finds the minimum and maximum possible durations for a given syntax, based on passing through all emitting states in sequence. Thus, the minimum duration is equal to the number of emitting states' maximum duration. At present, this function does not take account of any skips or self loops, but the maximum duration of -1 is reserved for models of possibly infinite duration.

SEG_ANN_DATA* segRecoverRecogSeq ( SEG_DP_ITEM **  dpMat,
SEG_SYNTAX syn,
int  numVecs,
int  numLabs 
)

Recover the model labels and their start and end times.

This function traces back through the DP matrix to obtain the model labels and their start and end times (in frame), ready to write them out in the master label file.

Parameters:
[in] dpMat Paths in the trellis for back-tracing
[in] syn Syntax
[in] numVecs Number of frames in the sequence
[in] numLabs Number of models in the sequence
Return values:
NULL Memory allocation error
otherwise Pointer to the array of struct annData variables each of which contains a label, and start and end times.
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
The first start time is always one but, for classification, the other times are as in the input label file rounded down to the nearest frame.
The purpose of this function is to create a structure in memory which corresponds to the label file which corresponds to the optimal state sequence. In other words, the i-th entry of this array consists of a structure which specifies the start time, end time and label of the i-th label (i.e., model) in the optimal decoding. This structure is the basis of the output for recognition.

SEG_STATE** segRecoverStateIds ( int *  stateSeq,
SEG_SYNTAX syn,
int  numVecs 
)

Recover the sequence of state identities from a state sequence.

This function returns the state identities (as pointers to states) of the best state sequence obtained by segRecoverStateSeq().

Parameters:
[in] stateSeq State sequence
[in] syn Syntax
[in] numVecs Number of frames in the utterance
Return values:
NULL Memory allocation error
otherwise Pointer to the array of struct stateInfo pointers
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
The purpose of this function is to create an array, one entry for each observation vector, such that the t-th entry is a pointer to the HMM state which corresponds to the syntax state at this point on the optimal state sequence. This is useful for re-estimation because it sets up a correspondence between each acoustic vector and the HMM state which it will contribute to for reestimation.
The previous fuction, segRecoverStateSeq(), recovers the indices of the optimal state sequence relative to the syntax. This is stored as an array of ints. The purpose of this function is to convert this sequence of ints into a sequence of pointers to states of actual models.

int* segRecoverStateSeq ( int *  numLabs,
SEG_DP_ITEM **  dpHist,
SEG_SYNTAX syn,
int  numVecs 
)

Recover the optimal state sequence from the path record of node.

This function is used to find the best state sequence by tracing back through the DP matrix with path record of each node in the trellis.

Parameters:
[in,out] numLabs Number of models in the sequence recovered
[in] dpHist Paths in the trellis for back-tracing
[in] syn Syntax
[in] numVecs Number of frames in the utterance
Return values:
NULL Memory allocation error
Otherwise Pointer to the array of state sequence recovered
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
The number of states in the recovered sequence is equal to the number of frames in the utterance. Each element in the sequence is the state number (index) of the corresponding emitting node, and all null states are discarded. This is used for training the model.
See also:
segRecoverStateIds(), segRecoverRecogSeq()

double segViterbiDecoder ( SEG_DP_ITEM ***  dpHist,
SEG_SYNTAX synt,
double **  spData,
int *  breakPt,
int  sT,
int  eT,
int  maxDur,
SEG_DEC_PARAM decParam 
)

Generic Viterbi-type decorder for segmental HMMs.

Parameters:
[out] dpHist Paths in the trellis for back-tracing
[in] synt Syntax
[in] spData Acoustic feature vectors
[in] breakPt Break point attributes
[in] sT Utterance start time (frame #)
[in] eT Utterance end time (frame #)
[in] maxDur Maximal segment-duration (Dmax)
[in] decParam Decoder parameters
Return values:
RTN_ERROR Memory allocation error
Otherwise The best cost (minProb) computed
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
The following functions are called internally: allocDpHistory(), initDecoder(), preCostPartition(), firstPropagator(), selector(), incSnpIdx(), propagator(), prunStartNode(), prunEndNode(), lastPropagator(), lastSelector(), and freeAllNode().
See also:
allocDpHistory(), initDecoder(), preCostPartition(), firstPropagator(), selector(), incSnpIdx(), propagator(), prunStartNode(), prunEndNode(), lastPropagator(), lastSelector() and freeAllNode().


Generated on Sun Aug 5 02:40:40 2007 for SEGRec Version 1.0 by  doxygen 1.5.1