📄 gauss_example_16s32f.txt
字号:
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
to delta calculation
number of calculated probabilities is returned
or -1 for wrong arguments
int State_Number(void) - get state number in calculator (state_number)
int Max_Gauss(void) - get maximal Gaussians in mixture (max_gauss)
int Feature_Length(void) - get feature vector length in calculator
short *Mean(int state) - get pointer to first element of first mean of state
short *Var(int state) - get pointer to first element of first var of state
float *Det(int state) - get pointer to first det of state
float *Weight(int state) - get pointer to first weight of state
Feat_Calc class
Calculates feature vectors for probability calculator. Fake producer provides zero
feature vectors. File producer takes data from HTK feature file with float data.
Two modes of feature processing are supported: raw features without energy (as for
the first decoder pass) and CMS&VN'ed features with energy (as for the second pass).
Delta or double delta are calculated if necessary. Calculated features are converted
to shorts.
Feat_Calc (int space_dim, int max_delay) - constructor
Each feature vector of length space_dim is
appended to the length (space_dim+3)&(~3)
for 16 byte alignment
max_delay is used to imitate low delay
feature producer - features are calculated by
portions of length no more than max_delay.
If deltas are calculated delta_delay =
delta_window*(delta_number+1) is added.
delta_delay is 0 for fake feature producer
If max_delay<=0 features for all utterance
could be calculated at once
Feature producer has no internal buffer and
calculates features in consumer's buffer
~Init_Feat(void) - destructor
int Init_Feat(int frame_number) - internal structures initialization for fake
int Init_Feat(char *file) and SDT based feature producers
Fake feature producer provides an utterance
of frame_number frames, each frame is zero
vector of length space_dim
HTK file based feature producer reads raw feature
vectors of length raw_dim from HTK feature file
Feature vector elements assumed to be floats.
space_dim should be equal to raw_dim, raw_dim*2,
raw_dim*3, (raw_dim-1), (raw_dim-1)*2 or
(raw_dim-1)*3. If necessary last element of
raw feature is deleted and deltas or double
deltas with delta_window=2 are calculated.
>= 0 if OK, otherwise failed
bool Set_Scale(int factor) - set scale factor for conversion of float features
to shorts, it coinsides with scale factor for
means
bool Set_Delta(float *mul) - set mul vector for delta calculation with
DeltaMul functions. DeltaMul functions are used
to equalize mean/var vector coordinate values and
to keep more precision after conversion to shorts.
Note that mul vector sets the multipliers for
mean vector coordinates. To use it in DeltaMul
functions we need to divide first delta
multipliers by base feature multipliers and to
divide second delta multipliers by first delta
multipliers
After successful constructor and Init_Feat calls producer is ready
bool Ready(void) - true if producer is ready, false otherwise
int Get_Feature(short *dst, int len, bool* end)
- puts calculated featurs to consumers buffer dst
len features is requested, the number of
fully calculated features is returned
if utterance is not ended they are followed by
delta_delay partially calculated feature vectors
The first partially calculated feature vector is
passed as dst for the next feature portion
if the calculated portion ends the utterance
end[0] is true otherwise false
int Feature_Length(void) - get output feature vector length
bool Var_Norm(void) - returns true if CMS and VN is done for phrase
It is necessary because of different delta
coefficients handling
int Delta_Delay(void) - get delta_delay of feature producer
Probability calculator requests this number to
provide correct interaction with probability
calculator
int Write_LogHeader(FILE *flog) - writes HTK feature file header to log file
feature vector length includes deltas or
double deltas if any
Mean and variance scaling
To use 16-bit integer representation of mean and variance the proper scaing factors
should be chosen. Too big factors lead to frequent saturations or overflows during
integer likelihood calculation. Too small factors lead to precision degradation.
Mean (and feature) vector coordinates are equalized to enhance precision. Variance
vector coordinates are divided by squared correspondent factors to keep the same
Mahalanobis distance. The following tables show the average and maximal likelihood
difference with float-point calculation results for dimension 36. Mean and variance
vectors are taken from model trained for 12 MFCC+double delta features. Columns for
mean and feature scaling factor, rows for variance scaling factors. Big numbers
means the overflow/saturation during calculations.
Average difference, LogGauss_Scaled
12 11 10 9 8 7 6 5 4
12 2.841 0.091 0.017 0.019 0.023 0.033 0.051 0.088 0.162
11 2.828 0.078 0.004 0.006 0.010 0.019 0.038 0.075 0.149
10 2.829 0.081 0.007 0.009 0.012 0.020 0.038 0.075 0.149
9 2.832 0.087 0.014 0.015 0.017 0.024 0.040 0.076 0.150
8 2.838 0.100 0.028 0.028 0.029 0.034 0.047 0.080 0.152
7 2.849 0.125 0.055 0.056 0.056 0.059 0.068 0.095 0.161
6 2.872 0.177 0.112 0.112 0.113 0.114 0.119 0.138 0.192
5 2.920 0.279 0.222 0.222 0.222 0.223 0.226 0.237 0.274
4 3.030 0.490 0.443 0.443 0.443 0.443 0.445 0.450 0.473
Maximal difference, LogGauss_Scaled
12 11 10 9 8 7 6 5 4
12 312.726 147.598 147.624 147.491 147.744 147.767 146.992 146.096 150.369
11 225.286 34.707 13.050 12.984 13.032 13.077 13.114 12.862 14.141
10 225.108 34.528 0.089 0.161 0.303 0.507 1.253 3.732 5.251
9 225.085 34.505 0.189 0.205 0.310 0.524 1.253 3.704 5.206
8 225.114 34.535 0.395 0.392 0.384 0.455 1.221 3.709 5.192
7 225.080 34.500 0.828 0.820 0.821 0.782 1.313 3.799 5.282
6 225.132 34.552 1.598 1.611 1.590 1.590 1.645 3.774 5.468
5 224.920 34.953 2.976 2.981 2.992 2.923 2.938 4.340 5.343
4 225.667 34.474 6.003 6.010 6.004 5.927 6.244 5.938 6.177
So the scaling factor 9-10 is OK as for means as for variances
Average difference, LogGauss_LowScaled
10 9 8 7 6 5 4 3 2
10 46.380 46.286 42.987 32.488 14.573 4.208 2.108 1.937 1.764
9 46.380 46.286 42.987 32.488 14.573 4.208 2.108 1.937 1.764
8 46.380 46.286 42.987 32.488 14.573 4.208 2.108 1.937 1.763
7 46.380 46.286 42.987 32.488 14.574 4.207 1.959 1.935 1.761
6 46.380 46.286 42.987 32.487 14.573 4.209 1.959 1.935 1.761
5 46.380 46.286 42.987 32.488 14.574 1.976 1.956 1.933 1.763
4 46.380 46.286 42.987 32.489 14.581 1.969 1.948 1.929 1.769
3 46.380 46.286 42.989 32.496 2.029 2.029 2.012 2.000 1.866
2 46.380 46.286 42.992 32.531 2.396 2.395 2.384 2.377 2.280
Maximal difference, LogGauss_LowScaled
10 9 8 7 6 5 4 3 2
10 376.214 364.862 347.218 303.902 202.035 122.936 76.197 11.364 15.629
9 376.214 364.582 347.218 303.902 202.035 122.936 76.197 11.364 15.629
8 376.214 364.582 347.218 303.902 202.035 122.936 76.197 11.364 15.629
7 376.214 364.582 347.218 303.902 201.921 122.936 11.121 11.364 15.629
6 376.214 364.582 347.218 303.902 201.921 122.936 11.140 11.420 15.629
5 376.214 364.582 347.218 303.902 202.759 11.321 11.060 12.339 16.629
4 376.214 364.582 347.218 303.902 201.941 11.700 11.918 11.899 14.629
3 376.214 364.582 347.218 303.902 13.350 13.350 13.712 14.082 14.930
2 376.214 364.582 347.218 303.902 24.449 24.449 24.449 24.446 23.721
So the scaling factor 4-5 is OK as for means as for variances
Functions with _Low suffix could be used for low magnitude means and variances.
They work faster on Pentium 4 processor at the expense of precision.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -