#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>
#include "segCommon.h"
#include "segStdLib.h"
#include "segReest.h"
Defines | |
#define | GAMMA_DUR_MODEL |
Defining this means the gamma function is used to approximate the duration distribution. | |
#define | DUR_PROB_OFFSET 0.0 |
This is used to avoid the duration model outputting BIGNUMs. | |
#define | DUR_SD_FLOOR (1/sqrt(2)) |
Floor of variance for the duration model. | |
Functions | |
static void | initTransProbs (SEG_TRPROB *transProb) |
Initialise accumulators for transition probabilities. | |
static void | initTrjModels (SEG_TRJ *trjModel) |
Initialise accumulators for trajectory model parameters. | |
static void | initDurModels (SEG_DUR *durModel) |
Initialise accumulators for duration model parameters. | |
static void | initStates (SEG_STATE *stateInfo) |
Initialise accumulators for state model parameters. | |
static void | reestTransProbs (SEG_TRPROB *transProb) |
Reestimate transition probabilities for a model. | |
static void | reestTrjModels (SEG_TRJ *trjModel, double minVar, double slopeRate, double varRate) |
Reestimate trajectory model parameters for a model. | |
static int | reestGammaDistDurModels (SEG_DUR *durModel, double durRegParam) |
Reestimate the gamma distribution of the duration model. | |
int | segIncrementLinearHMMAccumulators (SEG_STATE **stateId, int *stateSeq, SEG_SYNTAX *syn, double **spData, int sT, int eT, int maxDur) |
Increment the reestimation bins, according to the current utterance alignment. | |
int | segInitialiseHMMAccumulators (SEG_MODEL_SET *hmmSet) |
Initialise reestimation accumulators for the entire set of models. | |
static int | modelOccupancy (SEG_TRPROB *transProb) |
Count model occupancy on accumulators for transition probabilities. | |
static int | durModelOccupancy (SEG_DUR *durModel) |
Count duration model occupancy on accumulators for duration modelling. | |
int | segReestSegModels (SEG_MODEL_SET *hmmSet, SEG_CONFIG *config) |
Reestimate linear segmental-HMM parameters. |
static int durModelOccupancy | ( | SEG_DUR * | durModel | ) | [static] |
Count duration model occupancy on accumulators for duration modelling.
[in] | durModel | Pointer to a struct variable of the duration model |
static void initDurModels | ( | SEG_DUR * | durModel | ) | [static] |
Initialise accumulators for duration model parameters.
[in] | durModel | Pointer to a structure variable of the parameters |
static void initStates | ( | SEG_STATE * | stateInfo | ) | [static] |
Initialise accumulators for state model parameters.
[in] | stateInfo | Pointer to a structure variable of the parameters |
static void initTransProbs | ( | SEG_TRPROB * | transProb | ) | [static] |
Initialise accumulators for transition probabilities.
[in] | transProb | Pointer to a transition probability structure variable |
static void initTrjModels | ( | SEG_TRJ * | trjModel | ) | [static] |
Initialise accumulators for trajectory model parameters.
[in] | trjModel | Pointer to a structure variable of the parameters |
static int modelOccupancy | ( | SEG_TRPROB * | transProb | ) | [static] |
Count model occupancy on accumulators for transition probabilities.
[in] | transProb | Pointer to a struct variable of transition probabilities |
static int reestGammaDistDurModels | ( | SEG_DUR * | durModel, | |
double | durRegParam | |||
) | [static] |
Reestimate the gamma distribution of the duration model.
[in,out] | durModel | Pointer to a struct variable of the model |
[in] | durRegParam | Regularization parameter for duration training |
NO_ERROR | Successful execution | |
RTN_ERROR | No occupancy for the duration model |
static void reestTransProbs | ( | SEG_TRPROB * | transProb | ) | [static] |
static void reestTrjModels | ( | SEG_TRJ * | trjModel, | |
double | minVar, | |||
double | slopeRate, | |||
double | varRate | |||
) | [static] |
Reestimate trajectory model parameters for a model.
[in,out] | trjModel | Pointer to a structure variable of the parameter |
[in] | minVar | Floor for the variance of trajectory model |
[in] | slopeRate | Rate for updating the slope |
[in] | varRate | Rate for updating the variance |
int segIncrementLinearHMMAccumulators | ( | SEG_STATE ** | stateId, | |
int * | stateSeq, | |||
SEG_SYNTAX * | syn, | |||
double ** | spData, | |||
int | sT, | |||
int | eT, | |||
int | maxDur | |||
) |
Increment the reestimation bins, according to the current utterance alignment.
The function uses the optimal state sequence (i.e., the current utterance alignment) to add each acoustic vector to the accumulator of the corresponding HMM state on the optimal state sequence Linear trajectory model (i.e. slope and mean value).
[in,out] | stateId | Array of state IDs of the best state-sequence |
[in] | stateSeq | The best state sequence |
[in] | syn | Syntax |
[in] | spData | Acoustic feature vectors of speech data |
[in] | sT | Start time of the utterance |
[in] | eT | End time of the utterance |
[in] | maxDur | Maximum segment duration |
RTN_ERROR | Memory allocation error | |
NO_ERROR | Successfully executed |
int segInitialiseHMMAccumulators | ( | SEG_MODEL_SET * | hmmSet | ) |
Initialise reestimation accumulators for the entire set of models.
The function initialises reestimation accumulators for the entire set of models.
[in,out] | hmmSet | Model set |
int segReestSegModels | ( | SEG_MODEL_SET * | hmmSet, | |
SEG_CONFIG * | config | |||
) |
Reestimate linear segmental-HMM parameters.
The function reestimates the segmental HMMs using the accumulated values in the reestimation bins.
[in,out] | hmmSet | Model set |
[in] | config | Configuration parameters |
NO_ERROR | Successfully executed | |
RTN_ERROR | Too small number of samples for the model |