20 #ifndef KALDI_NNET2_NNET_EXAMPLE_FUNCTIONS_H_ 21 #define KALDI_NNET2_NNET_EXAMPLE_FUNCTIONS_H_ 88 max_length(1024), criterion(
"smbr"), collapse_transition_ids(true),
89 determinize(true), minimize(true), test(false), drop_frames(false),
90 split(true), excise(true) { }
94 opts->
Register(
"max-length", &max_length,
"Maximum length allowed for any " 95 "segment (i.e. max #frames for any example");
98 opts->
Register(
"criterion", &criterion,
"Criterion, 'mmi'|'mpfe'|'smbr'. " 99 "Determines which frames may be dropped from lattices.");
100 opts->
Register(
"collapse-transition-ids", &collapse_transition_ids,
101 "This option included for debugging purposes");
102 opts->
Register(
"determinize", &determinize,
"If true, we determinize " 103 "lattices (as Lattice) before splitting and possibly minimize");
104 opts->
Register(
"minimize", &minimize,
"If true, we push and " 105 "minimize lattices (as Lattice) before splitting");
106 opts->
Register(
"test", &test,
"If true, activate self-testing code.");
109 opts->
Register(
"drop-frames", &drop_frames,
"For MMI, if true we drop frames " 110 "with no overlap of num and den pdf-ids");
111 opts->
Register(
"split", &split,
"Set to false to disable lattice-splitting.");
112 opts->
Register(
"excise", &excise,
"Set to false to disable excising un-needed " 113 "frames (option included for debug purposes)");
141 const std::vector<int32> &alignment,
157 std::vector<DiscriminativeNnetExample> *egs_out,
167 std::vector<DiscriminativeNnetExample> *egs_out,
186 const std::vector<const DiscriminativeNnetExample*> &input,
211 const std::vector<DiscriminativeNnetExample> &input,
212 std::vector<DiscriminativeNnetExample> *output);
222 const std::vector<BaseFloat> &costs,
223 std::vector<std::vector<size_t> > *groups);
247 const std::vector<int32> &silence_phones,
250 bool one_silence_class,
287 std::string criterion,
289 bool one_silence_class,
300 #endif // KALDI_NNET2_NNET_EXAMPLE_FUNCTIONS_H_ bool collapse_transition_ids
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
int64 num_frames_kept_after_split
void SplitDiscriminativeExample(const SplitDiscriminativeExampleConfig &config, const TransitionModel &tmodel, const DiscriminativeNnetExample &eg, std::vector< DiscriminativeNnetExample > *egs_out, SplitExampleStats *stats_out)
Split a "discriminative example" into multiple pieces, splitting where the lattice has "pinch points"...
int64 num_frames_must_keep
void ExciseDiscriminativeExample(const SplitDiscriminativeExampleConfig &config, const TransitionModel &tmodel, const DiscriminativeNnetExample &eg, std::vector< DiscriminativeNnetExample > *egs_out, SplitExampleStats *stats_out)
Remove unnecessary frames from discriminative training example.
int32 longest_segment_after_excise
void UpdateHash(const TransitionModel &tmodel, const DiscriminativeNnetExample &eg, std::string criterion, bool drop_frames, bool one_silence_class, Matrix< double > *hash, double *num_weight, double *den_weight, double *tot_t)
This function is used in code that tests the functionality that we provide here, about splitting and ...
void CombineDiscriminativeExamples(int32 max_length, const std::vector< DiscriminativeNnetExample > &input, std::vector< DiscriminativeNnetExample > *output)
This function is used to combine multiple discriminative-training examples (each corresponding to a s...
This struct exists only for diagnostic purposes.
virtual void Register(const std::string &name, bool *ptr, const std::string &doc)=0
int32 longest_segment_after_split
int64 num_frames_kept_after_excise
std::vector< std::vector< std::pair< int32, BaseFloat > > > Posterior
Posterior is a typedef for storing acoustic-state (actually, transition-id) posteriors over an uttera...
void ExampleToPdfPost(const TransitionModel &tmodel, const std::vector< int32 > &silence_phones, std::string criterion, bool drop_frames, bool one_silence_class, const DiscriminativeNnetExample &eg, Posterior *post)
Given a discriminative training example, this function works out posteriors at the pdf level (note: t...
SplitDiscriminativeExampleConfig()
bool LatticeToDiscriminativeExample(const std::vector< int32 > &alignment, const Matrix< BaseFloat > &feats, const CompactLattice &clat, BaseFloat weight, int32 left_context, int32 right_context, DiscriminativeNnetExample *eg)
Converts lattice to discriminative training example.
void AppendDiscriminativeExamples(const std::vector< const DiscriminativeNnetExample *> &input, DiscriminativeNnetExample *output)
Appends the given vector of examples (which must be non-empty) into a single output example (called b...
void Register(OptionsItf *opts)
fst::VectorFst< CompactLatticeArc > CompactLattice
This struct is used to store the information we need for discriminative training (MMI or MPE)...
void Print(const Fst< Arc > &fst, std::string message)
void SolvePackingProblem(BaseFloat max_cost, const std::vector< BaseFloat > &costs, std::vector< std::vector< size_t > > *groups)
This function solves the "packing problem" using the "first fit" algorithm.
Config structure for SplitExample, for splitting discriminative training examples.