22 #ifndef KALDI_GMM_AM_DIAG_GMM_H_ 23 #define KALDI_GMM_AM_DIAG_GMM_H_ 1 57 int32 target_components,
float perturb_factor,
66 int32 target_components,
76 void Read(std::istream &in_stream,
bool binary);
77 void Write(std::ostream &out_stream,
bool binary)
const;
110 return densities_[pdf_index]->LogLikelihood(data);
135 densities_[pdf_index]->GetComponentMean(gauss, out);
142 densities_[pdf_index]->GetComponentVariance(gauss, out);
149 densities_[pdf_index]->SetComponentMean(gauss_index, in);
153 int32 target_components,
154 float perturb_factor) {
157 densities_[pdf_index]->Split(target_components, perturb_factor);
168 : ubm_num_gauss(400), reduce_state_factor(0.2),
169 intermediate_num_gauss(4000), cluster_varfloor(0.01),
170 max_am_gauss(20000) {}
173 : ubm_num_gauss(ncomp), reduce_state_factor(red),
174 intermediate_num_gauss(interm_gauss), cluster_varfloor(vfloor),
175 max_am_gauss(max_am_gauss) {}
177 std::string module =
"UbmClusteringOptions: ";
178 opts->
Register(
"max-am-gauss", &max_am_gauss, module+
179 "We first reduce acoustic model to this max #Gauss before clustering.");
180 opts->
Register(
"ubm-num-gauss", &ubm_num_gauss, module+
181 "Number of Gaussians components in the final UBM.");
182 opts->
Register(
"ubm-numcomps", &ubm_num_gauss, module+
183 "Backward compatibility option (see ubm-num-gauss)");
184 opts->
Register(
"reduce-state-factor", &reduce_state_factor, module+
185 "Intermediate number of clustered states (as fraction of total states).");
186 opts->
Register(
"intermediate-num-gauss", &intermediate_num_gauss, module+
187 "Intermediate number of merged Gaussian components.");
188 opts->
Register(
"intermediate-numcomps", &intermediate_num_gauss, module+
189 "Backward compatibility option (see intermediate-num-gauss)");
190 opts->
Register(
"cluster-varfloor", &cluster_varfloor, module+
191 "Variance floor used in bottom-up state clustering.");
219 #endif // KALDI_GMM_AM_DIAG_GMM_H_ This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void CopyFromAmDiagGmm(const AmDiagGmm &other)
Copies the parameters from another model. Allocates necessary memory.
void AddPdf(const DiagGmm &gmm)
Adds a GMM to the model, and increments the total number of PDFs.
void RemovePdf(int32 pdf_index)
int32 ComputeGconsts()
Sets the gconsts for all the PDFs.
void MergeByCount(const Vector< BaseFloat > &state_occs, int32 target_components, BaseFloat power, BaseFloat min_count)
void SetGaussianMean(int32 pdf_index, int32 gauss_index, const VectorBase< BaseFloat > &in)
Mutators.
int32 NumGaussInPdf(int32 pdf_index) const
virtual void Register(const std::string &name, bool *ptr, const std::string &doc)=0
void ClusterGaussiansToUbm(const AmDiagGmm &am, const Vector< BaseFloat > &state_occs, UbmClusteringOptions opts, DiagGmm *ubm_out)
Clusters the Gaussians in an acoustic model to a single GMM with specified number of components...
BaseFloat LogLikelihood(const int32 pdf_index, const VectorBase< BaseFloat > &data) const
void GetGaussianVariance(int32 pdf_index, int32 gauss, VectorBase< BaseFloat > *out) const
BaseFloat reduce_state_factor
std::vector< DiagGmm * > densities_
KALDI_DISALLOW_COPY_AND_ASSIGN(AmDiagGmm)
UbmClusteringOptions(int32 ncomp, BaseFloat red, int32 interm_gauss, BaseFloat vfloor, int32 max_am_gauss)
DiagGmm & GetPdf(int32 pdf_index)
Accessors.
void Register(OptionsItf *opts)
A class representing a vector.
#define KALDI_ASSERT(cond)
void Write(std::ostream &out_stream, bool binary) const
void GetGaussianMean(int32 pdf_index, int32 gauss, VectorBase< BaseFloat > *out) const
Definition for Gaussian Mixture Model with diagonal covariances.
int32 intermediate_num_gauss
void SplitPdf(int32 idx, int32 target_components, float perturb_factor)
Provides a vector abstraction class.
BaseFloat cluster_varfloor
void Init(const DiagGmm &proto, int32 num_pdfs)
Initializes with a single "prototype" GMM.
void Read(std::istream &in_stream, bool binary)
void SplitByCount(const Vector< BaseFloat > &state_occs, int32 target_components, float perturb_factor, BaseFloat power, BaseFloat min_count)