cmvn.h
Go to the documentation of this file.
1 // transform/cmvn.h
2 
3 // Copyright 2009-2013 Microsoft Corporation
4 // Johns Hopkins University (author: Daniel Povey)
5 
6 // See ../../COPYING for clarification regarding multiple authors
7 //
8 // Licensed under the Apache License, Version 2.0 (the "License");
9 // you may not use this file except in compliance with the License.
10 // You may obtain a copy of the License at
11 //
12 // http://www.apache.org/licenses/LICENSE-2.0
13 //
14 // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 // KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
16 // WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
17 // MERCHANTABLITY OR NON-INFRINGEMENT.
18 // See the Apache 2 License for the specific language governing permissions and
19 // limitations under the License.
20 
21 
22 #ifndef KALDI_TRANSFORM_CMVN_H_
23 #define KALDI_TRANSFORM_CMVN_H_
24 
25 #include "base/kaldi-common.h"
26 #include "matrix/matrix-lib.h"
27 
28 namespace kaldi {
29 
34 void InitCmvnStats(int32 dim, Matrix<double> *stats);
35 
37 void AccCmvnStats(const VectorBase<BaseFloat> &feat,
38  BaseFloat weight,
39  MatrixBase<double> *stats);
40 
42 void AccCmvnStats(const MatrixBase<BaseFloat> &feats,
43  const VectorBase<BaseFloat> *weights, // or NULL
44  MatrixBase<double> *stats);
45 
51 void ApplyCmvn(const MatrixBase<double> &stats,
52  bool norm_vars,
53  MatrixBase<BaseFloat> *feats);
54 
60 void ApplyCmvnReverse(const MatrixBase<double> &stats,
61  bool norm_vars,
62  MatrixBase<BaseFloat> *feats);
63 
64 
68 void FakeStatsForSomeDims(const std::vector<int32> &dims,
69  MatrixBase<double> *stats);
70 
71 
72 
73 } // namespace kaldi
74 
75 #endif // KALDI_TRANSFORM_CMVN_H_
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
kaldi::int32 int32
void ApplyCmvnReverse(const MatrixBase< double > &stats, bool var_norm, MatrixBase< BaseFloat > *feats)
This is as ApplyCmvn, but does so in the reverse sense, i.e.
Definition: cmvn.cc:117
float BaseFloat
Definition: kaldi-types.h:29
void InitCmvnStats(int32 dim, Matrix< double > *stats)
This function initializes the matrix to dimension 2 by (dim+1); 1st "dim" elements of 1st row are mea...
Definition: cmvn.cc:25
void AccCmvnStats(const VectorBase< BaseFloat > &feats, BaseFloat weight, MatrixBase< double > *stats)
Accumulation from a single frame (weighted).
Definition: cmvn.cc:30
void ApplyCmvn(const MatrixBase< double > &stats, bool var_norm, MatrixBase< BaseFloat > *feats)
Apply cepstral mean and variance normalization to a matrix of features.
Definition: cmvn.cc:64
void FakeStatsForSomeDims(const std::vector< int32 > &dims, MatrixBase< double > *stats)
Modify the stats so that for some dimensions (specified in "dims"), we replace them with "fake" stats...
Definition: cmvn.cc:168