28 using namespace kaldi;
31 typedef kaldi::int64 int64;
34 "Computes and prints in logging messages the average log-prob per frame of\n" 35 "the given data with an nnet3 neural net. The input of this is the output of\n" 36 "e.g. nnet3-get-egs | nnet3-merge-egs.\n" 38 "Usage: nnet3-compute-prob [options] <raw-model-in> <training-examples-in>\n" 39 "e.g.: nnet3-compute-prob 0.raw ark:valid.egs\n";
42 bool batchnorm_test_mode =
true, dropout_test_mode =
true,
43 collapse_model =
true;
53 po.Register(
"batchnorm-test-mode", &batchnorm_test_mode,
54 "If true, set test-mode to true on any BatchNormComponents.");
55 po.Register(
"dropout-test-mode", &dropout_test_mode,
56 "If true, set test-mode to true on any DropoutComponents and " 57 "DropoutMaskComponents.");
58 po.Register(
"collapse-model", &collapse_model,
59 "If true, collapse model to the extent possible before " 60 "using it (for efficiency).");
66 if (po.NumArgs() != 2) {
71 std::string raw_nnet_rxfilename = po.GetArg(1),
72 examples_rspecifier = po.GetArg(2);
77 if (batchnorm_test_mode)
80 if (dropout_test_mode)
90 for (; !example_reader.Done(); example_reader.Next())
91 prob_computer.Compute(example_reader.Value());
93 bool ok = prob_computer.PrintTotalStats();
96 }
catch(
const std::exception &e) {
97 std::cerr << e.what() <<
'\n';
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void CollapseModel(const CollapseModelConfig &config, Nnet *nnet)
This function modifies the neural net for efficiency, in a way that suitable to be done in test time...
void SetBatchnormTestMode(bool test_mode, Nnet *nnet)
This function affects only components of type BatchNormComponent.
This class is for computing cross-entropy and accuracy values in a neural network, for diagnostics.
void ReadKaldiObject(const std::string &filename, Matrix< float > *m)
void SetDropoutTestMode(bool test_mode, Nnet *nnet)
This function affects components of child-classes of RandomComponent.
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
void Register(OptionsItf *opts)
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
Config class for the CollapseModel function.