DecodableAmDiagGmmUnmapped is a decodable object that takes indices that correspond to pdf-id's plus one. More...
#include <decodable-am-diag-gmm.h>
Classes | |
struct | LikelihoodCacheRecord |
Defines a cache record for a state. More... | |
Public Member Functions | |
DecodableAmDiagGmmUnmapped (const AmDiagGmm &am, const Matrix< BaseFloat > &feats, BaseFloat log_sum_exp_prune=-1.0) | |
If you set log_sum_exp_prune to a value greater than 0 it will prune in the LogSumExp operation (larger = more exact); I suggest 5. More... | |
virtual BaseFloat | LogLikelihood (int32 frame, int32 state_index) |
Returns the log likelihood, which will be negated in the decoder. More... | |
virtual int32 | NumFramesReady () const |
The call NumFramesReady() will return the number of frames currently available for this decodable object. More... | |
virtual int32 | NumIndices () const |
Returns the number of states in the acoustic model (they will be indexed one-based, i.e. More... | |
virtual bool | IsLastFrame (int32 frame) const |
Returns true if this is the last frame. More... | |
Public Member Functions inherited from DecodableInterface | |
virtual | ~DecodableInterface () |
Protected Member Functions | |
void | ResetLogLikeCache () |
virtual BaseFloat | LogLikelihoodZeroBased (int32 frame, int32 state_index) |
Protected Attributes | |
const AmDiagGmm & | acoustic_model_ |
const Matrix< BaseFloat > & | feature_matrix_ |
int32 | previous_frame_ |
BaseFloat | log_sum_exp_prune_ |
std::vector< LikelihoodCacheRecord > | log_like_cache_ |
Private Member Functions | |
KALDI_DISALLOW_COPY_AND_ASSIGN (DecodableAmDiagGmmUnmapped) | |
Private Attributes | |
Vector< BaseFloat > | data_squared_ |
Cache for fast likelihood calculation. More... | |
DecodableAmDiagGmmUnmapped is a decodable object that takes indices that correspond to pdf-id's plus one.
This may be used in future in a decoder that doesn't need to output alignments, if we create FSTs that have the pdf-ids plus one as the input labels (we couldn't use the pdf-ids themselves because they start from zero, and the graph might have epsilon transitions).
Definition at line 45 of file decodable-am-diag-gmm.h.
|
inline |
If you set log_sum_exp_prune to a value greater than 0 it will prune in the LogSumExp operation (larger = more exact); I suggest 5.
This is advisable if it's spending a long time doing exp operations.
Definition at line 51 of file decodable-am-diag-gmm.h.
References DecodableAmDiagGmmUnmapped::ResetLogLikeCache().
Returns true if this is the last frame.
Frames are zero-based, so the first frame is zero. IsLastFrame(-1) will return false, unless the file is empty (which is a case that I'm not sure all the code will handle, so be careful). Caution: the behavior of this function in an online setting is being changed somewhat. In future it may return false in cases where we haven't yet decided to terminate decoding, but later true if we decide to terminate decoding. The plan in future is to rely more on NumFramesReady(), and in future, IsLastFrame() would always return false in an online-decoding setting, and would only return true in a decoding-from-matrix setting where we want to allow the last delta or LDA features to be flushed out for compatibility with the baseline setup.
Implements DecodableInterface.
Definition at line 70 of file decodable-am-diag-gmm.h.
References KALDI_ASSERT, DecodableAmDiagGmmUnmapped::LogLikelihoodZeroBased(), DecodableAmDiagGmmUnmapped::NumFramesReady(), and DecodableAmDiagGmmUnmapped::ResetLogLikeCache().
|
private |
Returns the log likelihood, which will be negated in the decoder.
The "frame" starts from zero. You should verify that NumFramesReady() > frame before calling this.
Implements DecodableInterface.
Reimplemented in DecodableAmDiagGmmScaled, DecodableAmDiagGmm, DecodableAmDiagGmmRegtreeMllr, and DecodableAmDiagGmmRegtreeFmllr.
Definition at line 62 of file decodable-am-diag-gmm.h.
References DecodableAmDiagGmmUnmapped::LogLikelihoodZeroBased().
Reimplemented in DecodableAmDiagGmmRegtreeMllr, and DecodableAmDiagGmmRegtreeFmllr.
Definition at line 28 of file decodable-am-diag-gmm.cc.
References DecodableAmDiagGmmUnmapped::acoustic_model_, VectorBase< Real >::AddMatVec(), DecodableAmDiagGmmUnmapped::data_squared_, VectorBase< Real >::Dim(), DiagGmm::Dim(), DecodableAmDiagGmmUnmapped::feature_matrix_, DiagGmm::gconsts(), AmDiagGmm::GetPdf(), DiagGmm::inv_vars(), KALDI_ASSERT, KALDI_ERR, KALDI_ISINF, KALDI_ISNAN, kaldi::kNoTrans, DecodableAmDiagGmmUnmapped::log_like_cache_, DecodableAmDiagGmmUnmapped::log_sum_exp_prune_, DiagGmm::means_invvars(), DecodableAmDiagGmmUnmapped::NumFramesReady(), DecodableAmDiagGmmUnmapped::NumIndices(), DecodableAmDiagGmmUnmapped::previous_frame_, MatrixBase< Real >::Row(), and DiagGmm::valid_gconsts().
Referenced by DecodableAmDiagGmmUnmapped::IsLastFrame(), DecodableAmDiagGmmUnmapped::LogLikelihood(), DecodableAmDiagGmm::LogLikelihood(), and DecodableAmDiagGmmScaled::LogLikelihood().
|
inlinevirtual |
The call NumFramesReady() will return the number of frames currently available for this decodable object.
This is for use in setups where you don't want the decoder to block while waiting for input. This is newly added as of Jan 2014, and I hope, going forward, to rely on this mechanism more than IsLastFrame to know when to stop decoding.
Reimplemented from DecodableInterface.
Reimplemented in DecodableAmDiagGmmRegtreeMllr, and DecodableAmDiagGmmRegtreeFmllr.
Definition at line 65 of file decodable-am-diag-gmm.h.
References DecodableAmDiagGmmUnmapped::feature_matrix_, and MatrixBase< Real >::NumRows().
Referenced by DecodableAmDiagGmmUnmapped::IsLastFrame(), DecodableAmDiagGmmUnmapped::LogLikelihoodZeroBased(), and main().
|
inlinevirtual |
Returns the number of states in the acoustic model (they will be indexed one-based, i.e.
from 1 to NumIndices(); this is for compatibility with OpenFst).
Implements DecodableInterface.
Reimplemented in DecodableAmDiagGmmScaled, DecodableAmDiagGmm, DecodableAmDiagGmmRegtreeMllr, and DecodableAmDiagGmmRegtreeFmllr.
Definition at line 68 of file decodable-am-diag-gmm.h.
References DecodableAmDiagGmmUnmapped::acoustic_model_, and AmDiagGmm::NumPdfs().
Referenced by DecodableAmDiagGmmUnmapped::LogLikelihoodZeroBased().
|
protected |
Definition at line 74 of file decodable-am-diag-gmm.cc.
References DecodableAmDiagGmmUnmapped::acoustic_model_, DecodableAmDiagGmmUnmapped::log_like_cache_, and AmDiagGmm::NumPdfs().
Referenced by DecodableAmDiagGmmUnmapped::DecodableAmDiagGmmUnmapped(), DecodableAmDiagGmmRegtreeMllr::InitCache(), and DecodableAmDiagGmmUnmapped::IsLastFrame().
|
protected |
Definition at line 79 of file decodable-am-diag-gmm.h.
Referenced by DecodableAmDiagGmmRegtreeMllr::GetXformedMeanInvVars(), DecodableAmDiagGmmRegtreeMllr::InitCache(), DecodableAmDiagGmmRegtreeFmllr::LogLikelihoodZeroBased(), DecodableAmDiagGmmUnmapped::LogLikelihoodZeroBased(), DecodableAmDiagGmmRegtreeMllr::LogLikelihoodZeroBased(), DecodableAmDiagGmmUnmapped::NumIndices(), and DecodableAmDiagGmmUnmapped::ResetLogLikeCache().
Cache for fast likelihood calculation.
Definition at line 91 of file decodable-am-diag-gmm.h.
Referenced by DecodableAmDiagGmmUnmapped::LogLikelihoodZeroBased(), and DecodableAmDiagGmmRegtreeMllr::LogLikelihoodZeroBased().
Definition at line 80 of file decodable-am-diag-gmm.h.
Referenced by DecodableAmDiagGmmRegtreeFmllr::LogLikelihoodZeroBased(), DecodableAmDiagGmmUnmapped::LogLikelihoodZeroBased(), DecodableAmDiagGmmRegtreeMllr::LogLikelihoodZeroBased(), DecodableAmDiagGmmRegtreeFmllr::NumFramesReady(), DecodableAmDiagGmmUnmapped::NumFramesReady(), and DecodableAmDiagGmmRegtreeMllr::NumFramesReady().
|
protected |
|
protected |
Definition at line 82 of file decodable-am-diag-gmm.h.
Referenced by DecodableAmDiagGmmRegtreeFmllr::LogLikelihoodZeroBased(), DecodableAmDiagGmmUnmapped::LogLikelihoodZeroBased(), and DecodableAmDiagGmmRegtreeMllr::LogLikelihoodZeroBased().
|
protected |
Definition at line 81 of file decodable-am-diag-gmm.h.
Referenced by DecodableAmDiagGmmRegtreeFmllr::LogLikelihoodZeroBased(), DecodableAmDiagGmmUnmapped::LogLikelihoodZeroBased(), and DecodableAmDiagGmmRegtreeMllr::LogLikelihoodZeroBased().