This struct is used to store the information we need for discriminative training (MMI or MPE). More...
#include <nnet-example.h>
Public Member Functions | |
void | Check () const |
void | Write (std::ostream &os, bool binary) const |
void | Read (std::istream &is, bool binary) |
Public Attributes | |
BaseFloat | weight |
The weight we assign to this example; this will typically be one, but we include it for the sake of generality. More... | |
std::vector< int32 > | num_ali |
The numerator alignment. More... | |
CompactLattice | den_lat |
The denominator lattice. More... | |
Matrix< BaseFloat > | input_frames |
The input data– typically with a number of frames [NumRows()] larger than labels.size(), because it includes features to the left and right as needed for the temporal context of the network. More... | |
int32 | left_context |
The number of frames of left context in the features (we can work out the #frames of right context from input_frames.NumRows(), num_ali.size(), and this). More... | |
Vector< BaseFloat > | spk_info |
spk_info contains any component of the features that varies slowly or not at all with time (and hence, we would lose little by averaging it over time and storing the average). More... | |
This struct is used to store the information we need for discriminative training (MMI or MPE).
Each example corresponds to one chunk of a file (for better randomization and to prevent instability, we may split files in the middle). The example contains the numerator alignment, the denominator lattice, and the input features (extended at the edges according to the left-context and right-context the network needs). It may also contain a speaker-vector (note: this is not part of any standard recipe right now but is included in case it's useful in the future).
Definition at line 136 of file nnet-example.h.
void Check | ( | ) | const |
Definition at line 295 of file nnet-example.cc.
References kaldi::CompactLatticeStateTimes(), NnetExample::input_frames, KALDI_ASSERT, NnetExample::left_context, and CompressedMatrix::NumRows().
Referenced by DiscriminativeExampleSplitter::DoExcise(), DiscriminativeExampleSplitter::Excise(), kaldi::nnet2::LatticeToDiscriminativeExample(), DiscriminativeExampleSplitter::OutputOneSplit(), and DiscriminativeExampleSplitter::Split().
void Read | ( | std::istream & | is, |
bool | binary | ||
) |
Definition at line 269 of file nnet-example.cc.
References kaldi::ExpectToken(), NnetExample::input_frames, KALDI_ERR, NnetExample::left_context, CompressedMatrix::Read(), kaldi::ReadBasicType(), kaldi::ReadCompactLattice(), kaldi::ReadIntegerVector(), and NnetExample::spk_info.
void Write | ( | std::ostream & | os, |
bool | binary | ||
) | const |
Definition at line 242 of file nnet-example.cc.
References NnetExample::input_frames, KALDI_ERR, NnetExample::left_context, NnetExample::spk_info, CompressedMatrix::Write(), kaldi::WriteBasicType(), kaldi::WriteCompactLattice(), kaldi::WriteIntegerVector(), and kaldi::WriteToken().
CompactLattice den_lat |
The denominator lattice.
Note: any acoustic likelihoods in the denominator lattice will be recomputed at the time we train.
Definition at line 148 of file nnet-example.h.
Referenced by kaldi::nnet2::AppendDiscriminativeExamples(), DiscriminativeExampleSplitter::DoExcise(), kaldi::nnet2::ExampleToPdfPost(), NnetDiscriminativeUpdater::LatticeComputations(), kaldi::nnet2::LatticeToDiscriminativeExample(), main(), DiscriminativeExampleSplitter::OutputOneSplit(), and DiscriminativeExampleSplitter::PrepareLattice().
The input data– typically with a number of frames [NumRows()] larger than labels.size(), because it includes features to the left and right as needed for the temporal context of the network.
(see also the left_context variable). Caution: when we write this to disk, we do so as CompressedMatrix. Because we do various manipulations on these things in memory, such as splitting, we don't want it to be a CompressedMatrix in memory as this would be wasteful in time and also would lead to further loss of accuracy.
Definition at line 159 of file nnet-example.h.
Referenced by kaldi::nnet2::AppendDiscriminativeExamples(), kaldi::nnet2::AverageConstPart(), DiscriminativeExampleSplitter::DoExcise(), NnetDiscriminativeUpdater::GetInputFeatures(), kaldi::nnet2::LatticeToDiscriminativeExample(), main(), NnetDiscriminativeUpdater::NnetDiscriminativeUpdater(), DiscriminativeExampleSplitter::OutputOneSplit(), DiscriminativeExampleSplitter::RightContext(), and kaldi::nnet2::UpdateHash().
int32 left_context |
The number of frames of left context in the features (we can work out the #frames of right context from input_frames.NumRows(), num_ali.size(), and this).
Definition at line 164 of file nnet-example.h.
Referenced by kaldi::nnet2::AppendDiscriminativeExamples(), DiscriminativeExampleSplitter::DoExcise(), NnetDiscriminativeUpdater::GetInputFeatures(), kaldi::nnet2::LatticeToDiscriminativeExample(), DiscriminativeExampleSplitter::OutputOneSplit(), DiscriminativeExampleSplitter::RightContext(), and kaldi::nnet2::UpdateHash().
std::vector<int32> num_ali |
The numerator alignment.
Definition at line 143 of file nnet-example.h.
Referenced by kaldi::nnet2::AppendDiscriminativeExamples(), DiscriminativeExampleSplitter::ComputeFrameInfo(), DiscriminativeExampleSplitter::DoExcise(), kaldi::nnet2::ExampleToPdfPost(), NnetDiscriminativeUpdater::GetDiscriminativePosteriors(), NnetDiscriminativeUpdater::GetInputFeatures(), NnetDiscriminativeUpdater::LatticeComputations(), kaldi::nnet2::LatticeToDiscriminativeExample(), DiscriminativeExampleSplitter::NumFrames(), DiscriminativeExampleSplitter::OutputOneSplit(), and kaldi::nnet2::UpdateHash().
spk_info contains any component of the features that varies slowly or not at all with time (and hence, we would lose little by averaging it over time and storing the average).
We'll append this to each of the input features, if used.
Definition at line 171 of file nnet-example.h.
Referenced by kaldi::nnet2::AppendDiscriminativeExamples(), kaldi::nnet2::AverageConstPart(), DiscriminativeExampleSplitter::DoExcise(), DiscriminativeExampleSplitter::OutputOneSplit(), and NnetDiscriminativeUpdater::Propagate().
BaseFloat weight |
The weight we assign to this example; this will typically be one, but we include it for the sake of generality.
Definition at line 140 of file nnet-example.h.
Referenced by kaldi::nnet2::AppendDiscriminativeExamples(), DiscriminativeExampleSplitter::DoExcise(), kaldi::nnet2::ExampleToPdfPost(), NnetDiscriminativeUpdater::LatticeComputations(), kaldi::nnet2::LatticeToDiscriminativeExample(), and DiscriminativeExampleSplitter::OutputOneSplit().