Some normalizations to ET options.

git-svn-id: https://svn.code.sf.net/p/kaldi/code/trunk@132 5e6a8d80-dfce-4ca6-a32a-6e07a63d50c8
This commit is contained in:
Dan Povey 2011-07-13 00:51:04 +00:00
Родитель 8c1d8fc8c8
Коммит d698ad7ef0
22 изменённых файлов: 43 добавлений и 38 удалений

Просмотреть файл

@ -46,7 +46,7 @@ for test in mar87 oct87 feb89 oct89 feb91 sep92; do
( ali-to-post ark:$dir/test_${test}_pre.ali ark:- | \
weight-silence-post 0.0 $silphones $alignmodel ark:- ark:- | \
gmm-post-to-gpost $alignmodel "$defaultfeats" ark:- ark:- | \
gmm-est-et $spk2utt_opt --normalize-type=mean-and-var --verbose=1 $model $et \
gmm-est-et $spk2utt_opt --normalize-type=diag --verbose=1 $model $et \
"$sifeats" ark:- ark:$dir/et_${test}.trans ark,t:$dir/et_${test}.warp ) \
2>$dir/et_${test}.log || exit 1;

Просмотреть файл

@ -45,7 +45,7 @@ for test in mar87 oct87 feb89 oct89 feb91 sep92; do
( ali-to-post ark:$dir/test_${test}_pre.ali ark:- | \
weight-silence-post 0.0 $silphones $alignmodel ark:- ark:- | \
gmm-post-to-gpost $alignmodel "$defaultfeats" ark:- ark:- | \
gmm-est-et $spk2utt_opt --normalize-type=mean-and-var --verbose=1 $model $et \
gmm-est-et $spk2utt_opt --normalize-type=diag --verbose=1 $model $et \
"$sifeats" ark:- ark:$dir/et_${test}.trans ark,t:$dir/et_${test}.warp ) \
2>$dir/et_${test}.log || exit 1;

Просмотреть файл

@ -47,7 +47,7 @@ for test in mar87 oct87 feb89 oct89 feb91 sep92; do
( ali-to-post ark:$dir/test_${test}_pre.ali ark:- | \
weight-silence-post 0.0 $silphones $alignmodel ark:- ark:- | \
gmm-post-to-gpost $alignmodel "$defaultfeats" ark:- ark:- | \
gmm-est-et $spk2utt_opt --normalize-type=mean-and-var --verbose=1 $model $et \
gmm-est-et $spk2utt_opt --normalize-type=diag --verbose=1 $model $et \
"$sifeats" ark:- ark:$dir/et_${test}.trans ark,t:$dir/et_${test}.warp ) \
2>$dir/et_${test}.log || exit 1;

Просмотреть файл

@ -47,7 +47,7 @@ for test in mar87 oct87 feb89 oct89 feb91 sep92; do
( ali-to-post ark:$dir/test_${test}_pass1.ali ark:- | \
weight-silence-post 0.0 $silphones $alignmodel ark:- ark:- | \
gmm-post-to-gpost $alignmodel "$defaultfeats" ark:- ark:- | \
gmm-est-et $spk2utt_opt --normalize-type=mean-and-var --verbose=1 $model $et \
gmm-est-et $spk2utt_opt --normalize-type=diag --verbose=1 $model $et \
"$basefeats" ark:- ark:$dir/et_${test}.trans ark,t:$dir/et_${test}.warp ) \
2>$dir/et_${test}.log || exit 1;

Просмотреть файл

@ -52,7 +52,7 @@ for test in mar87 oct87 feb89 oct89 feb91 sep92; do
( ali-to-post ark:$dir/test_${test}_pass1.ali ark:- | \
weight-silence-post 0.0 $silphones $alignmodel ark:- ark:- | \
gmm-post-to-gpost $alignmodel "$defaultfeats" ark:- ark:- | \
gmm-est-et $spk2utt_opt --normalize-type=mean-and-var --verbose=1 $model $et \
gmm-est-et $spk2utt_opt --normalize-type=diag --verbose=1 $model $et \
"$basefeats" ark:- ark:$dir/et_${test}.trans ark,t:$dir/et_${test}.warp ) \
2>$dir/et_${test}.log || exit 1;

Просмотреть файл

@ -47,7 +47,7 @@ for test in mar87 oct87 feb89 oct89 feb91 sep92; do
( ali-to-post ark:$dir/test_${test}_pre.ali ark:- | \
weight-silence-post 0.0 $silphones $alignmodel ark:- ark:- | \
gmm-post-to-gpost $alignmodel "$defaultfeats" ark:- ark:- | \
gmm-est-et $spk2utt_opt --normalize-type=mean-and-var --verbose=1 $model $et \
gmm-est-et $spk2utt_opt --normalize-type=diag --verbose=1 $model $et \
"$sifeats" ark:- ark:$dir/et_${test}.trans ark,t:$dir/et_${test}.warp ) \
2>$dir/et_${test}.log || exit 1;

Просмотреть файл

@ -33,7 +33,7 @@ spk2utt_opt=--spk2utt=ark:$dir/spk2utt
# the utt2spk opt is used by programs that use all the data so give
# it the original utt2spk file.
utt2spk_opt=--utt2spk=ark:data/train.utt2spk
normtype=mean # et option; could be mean, or none
normtype=offset # et option; could be offset [recommended], or none
numiters=30 # Number of iterations of training
maxiterinc=20 # Last iter to increase #Gauss on.

Просмотреть файл

@ -34,7 +34,7 @@ spk2utt_opt=--spk2utt=ark:$dir/spk2utt
# the utt2spk opt is used by programs that use all the data so give
# it the original utt2spk file.
utt2spk_opt=--utt2spk=ark:data/train.utt2spk
normtype=mean # et option; could be mean, or none
normtype=offset # et option; could be offset [recommended], or none
numiters=30 # Number of iterations of training
maxiterinc=20 # Last iter to increase #Gauss on.

Просмотреть файл

@ -126,7 +126,8 @@ exp/decode_tri2e_tgpr_eval92/wer:%WER 14.29 [ 806 / 5641, 155 ins, 79 del, 572 s
exp/decode_tri2e_tgpr_eval93/wer:%WER 19.08 [ 656 / 3439, 71 ins, 120 del, 465 sub ]
exp/decode_tri2f_tgpr_eval92/wer:%WER 12.23 [ 690 / 5641, 138 ins, 57 del, 495 sub ]
exp/decode_tri2f_tgpr_eval93/wer:%WER 17.74 [ 610 / 3439, 68 ins, 85 del, 457 sub ]
# with acwt 1/17:
# with acwt 1/17. note: better here, but wasn't for tri2k, so leaving it at
# 1/16 for these types of features.
exp/decode_tri2f_tgpr_eval92/wer:%WER 12.16 [ 686 / 5641, 128 ins, 59 del, 499 sub ]
exp/decode_tri2f_tgpr_eval93/wer:%WER 17.56 [ 604 / 3439, 61 ins, 92 del, 451 sub ]
@ -158,6 +159,10 @@ exp/decode_tri2k_tgpr_fmllr_eval93/wer:%WER 13.70 [ 471 / 3439, 71 ins, 60 del,
exp/decode_tri2k_tgpr_utt_eval92/wer:%WER 10.41 [ 587 / 5641, 112 ins, 50 del, 425 sub ]
exp/decode_tri2k_tgpr_utt_eval93/wer:%WER 14.63 [ 503 / 3439, 67 ins, 65 del, 371 sub ]
exp/decode_tri2k_tgpr_utt_eval92.acwt17/wer:%WER 10.44 [ 589 / 5641, 109 ins, 51 del, 429 sub ]
exp/decode_tri2k_tgpr_utt_eval93.acwt17/wer:%WER 14.77 [ 508 / 3439, 64 ins, 72 del, 372 sub ]
exp/decode_tri2l_tgpr_eval92/wer:%WER 9.64 [ 544 / 5641, 121 ins, 44 del, 379 sub ]
exp/decode_tri2l_tgpr_eval93/wer:%WER 13.72 [ 472 / 3439, 68 ins, 66 del, 338 sub ]
exp/decode_tri2l_tgpr_utt_eval92/wer:%WER 12.00 [ 677 / 5641, 141 ins, 60 del, 476 sub ]

Просмотреть файл

@ -416,9 +416,8 @@ steps/train_sgmm2e.sh || exit 1;
(scripts/mkgraph.sh data/G_tg_pruned.fst exp/sgmm2e/tree exp/sgmm2e/final.mdl exp/graph_sgmm2e_tg_pruned || exit 1;
for year in 92 93; do
scripts/decode.sh --per-spk exp/decode_sgmm2e_tgpr_eval${year} exp/graph_sgmm2e_tg_pruned/HCLG.fst steps/decode_sgmm2e.sh data/eval_nov${year}.scp exp/graph_tri2k_tg_pruned/HCLG.fst
p
# scripts/decode.sh exp/decode_sgmm2e_tgpr_utt_eval${year} exp/graph_sgmm2e_tg_pruned/HCLG.fst steps/decode_sgmm2e.sh data/eval_nov${year}.scp
# scripts/decode.sh --per-spk exp/decode_sgmm2e_fmllr_tgpr_eval${year} exp/graph_sgmm2e_tg_pruned/HCLG.fst steps/decode_sgmm2e_fmllr.sh data/eval_nov${year}.scp
scripts/decode.sh exp/decode_sgmm2e_tgpr_utt_eval${year} exp/graph_sgmm2e_tg_pruned/HCLG.fst steps/decode_sgmm2e.sh data/eval_nov${year}.scp
scripts/decode.sh --per-spk exp/decode_sgmm2e_fmllr_tgpr_eval${year} exp/graph_sgmm2e_tg_pruned/HCLG.fst steps/decode_sgmm2e_fmllr.sh data/eval_nov${year}.scp
done
)&

Просмотреть файл

@ -74,7 +74,7 @@ gmm-decode-faster --beam=$prebeam --max-active=$max_active --acoustic-scale=$acw
(ali-to-post ark:$dir/$job.pre_ali ark:- | \
weight-silence-post 0.0 $silphones $alimodel ark:- ark:- | \
gmm-post-to-gpost $alimodel "$defaultfeats" ark,o:- ark:- | \
gmm-est-et --normalize-type=mean-and-var $spk2utt_opt $model $et "$sifeats" ark,o:- \
gmm-est-et --normalize-type=diag $spk2utt_opt $model $et "$sifeats" ark,o:- \
ark:$dir/$job.trans ark,t:$dir/$job.warp ) 2>$dir/et${job}.log
feats="ark:splice-feats --print-args=false scp:$scp ark:- | transform-feats $ldamat ark:- ark:- | transform-feats $utt2spk_opt ark:$dir/$job.trans ark:- ark:- |"

Просмотреть файл

@ -75,7 +75,7 @@ gmm-decode-faster --beam=$prebeam --max-active=$max_active --acoustic-scale=$acw
(ali-to-post ark:$dir/$job.pre_ali ark:- | \
weight-silence-post 0.0 $silphones $alimodel ark:- ark:- | \
gmm-post-to-gpost $alimodel "$defaultfeats" ark,o:- ark:- | \
gmm-est-et --normalize-type=mean-and-var $spk2utt_opt $model $et "$sifeats" ark,o:- \
gmm-est-et --normalize-type=diag $spk2utt_opt $model $et "$sifeats" ark,o:- \
ark:$dir/$job.trans ark,t:$dir/$job.warp ) 2>$dir/et${job}.log
feats="ark:splice-feats --print-args=false scp:$scp ark:- | transform-feats $ldamat ark:- ark:- | transform-feats $utt2spk_opt ark:$dir/$job.trans ark:- ark:- |"

Просмотреть файл

@ -74,7 +74,7 @@ gmm-decode-faster --beam=$prebeam --max-active=$max_active --acoustic-scale=$acw
(ali-to-post ark:$dir/$job.pre_ali ark:- | \
weight-silence-post 0.0 $silphones $alimodel ark:- ark:- | \
gmm-post-to-gpost $alimodel "$defaultfeats" ark,o:- ark:- | \
gmm-est-et --normalize-type=mean-and-var $spk2utt_opt $model $et "$sifeats" ark,o:- \
gmm-est-et --normalize-type=diag $spk2utt_opt $model $et "$sifeats" ark,o:- \
ark:$dir/$job.trans ark,t:$dir/$job.warp ) 2>$dir/et${job}.log
feats="ark:splice-feats --print-args=false scp:$scp ark:- | transform-feats $ldamat ark:- ark:- | transform-feats $utt2spk_opt ark:$dir/$job.trans ark:- ark:- |"

Просмотреть файл

@ -75,7 +75,7 @@ gmm-decode-faster --beam=$prebeam --max-active=$max_active --acoustic-scale=$acw
(ali-to-post ark:$dir/$job.pre_ali ark:- | \
weight-silence-post 0.0 $silphones $alimodel ark:- ark:- | \
gmm-post-to-gpost $alimodel "$defaultfeats" ark,o:- ark:- | \
gmm-est-et --normalize-type=mean-and-var $spk2utt_opt $model $et "$sifeats" ark,o:- \
gmm-est-et --normalize-type=diag $spk2utt_opt $model $et "$sifeats" ark,o:- \
ark:$dir/$job.trans ark,t:$dir/$job.warp ) 2>$dir/et${job}.log
feats="ark:splice-feats --print-args=false scp:$scp ark:- | transform-feats $ldamat ark:- ark:- | transform-feats $utt2spk_opt ark:$dir/$job.trans ark:- ark:- |"

Просмотреть файл

@ -28,7 +28,7 @@ scale_opts="--transition-scale=1.0 --acoustic-scale=0.1 --self-loop-scale=0.1"
# The 3 following settings relate to ET.
dim=39 # the dim of our features.
normtype=mean
normtype=offset # et option; could be offset [recommended], or none
numiters_et=15 # Before this, update et.
numiters=35

Просмотреть файл

@ -27,7 +27,7 @@ scale_opts="--transition-scale=1.0 --acoustic-scale=0.1 --self-loop-scale=0.1"
# The 3 following settings relate to ET.
dim=40 # the dim of our features.
normtype=mean
normtype=offset # et option; could be offset [recommended], or none
numiters_et=15 # Before this, update et.
numiters=35

Просмотреть файл

@ -59,8 +59,8 @@ int main(int argc, char *argv[])
if (normalize_type != "") {
EtNormalizeType nt;
if (normalize_type == "mean") nt = kEtNormalizeMean;
else if (normalize_type == "mean-and-var") nt = kEtNormalizeMeanAndVar;
if (normalize_type == "offset") nt = kEtNormalizeOffset;
else if (normalize_type == "diag") nt = kEtNormalizeDiag;
else if (normalize_type == "none") nt = kEtNormalizeNone;
// "none" unlikely, since pointless: only allowed if already == none.
else KALDI_ERR << "Invalid normalize-type option: " << normalize_type;

Просмотреть файл

@ -85,8 +85,8 @@ int main(int argc, char *argv[]) {
if (normalize_type != "") {
EtNormalizeType nt;
if (normalize_type == "offset" || normalize_type == "mean") nt = kEtNormalizeMean;
else if (normalize_type == "diag" || normalize_type == "mean-and-var") nt = kEtNormalizeMeanAndVar;
if (normalize_type == "offset") nt = kEtNormalizeOffset;
else if (normalize_type == "diag") nt = kEtNormalizeDiag;
else if (normalize_type == "none") nt = kEtNormalizeNone;
// "none" unlikely, since pointless: only allowed if already == none.
else KALDI_ERR << "Invalid normalize-type option: " << normalize_type;

Просмотреть файл

@ -52,8 +52,8 @@ int main(int argc, char *argv[])
}
EtNormalizeType norm_type;
if (normalize_type == "offset" || normalize_type == "mean") norm_type = kEtNormalizeMean;
else if (normalize_type == "diag" || normalize_type == "mean-and-var") norm_type = kEtNormalizeMeanAndVar;
if (normalize_type == "offset") norm_type = kEtNormalizeOffset;
else if (normalize_type == "diag") norm_type = kEtNormalizeDiag;
else if (normalize_type == "none") norm_type = kEtNormalizeNone;
else
KALDI_EXIT << "Invalid option --normalize-type=" << normalize_type;

Просмотреть файл

@ -186,8 +186,8 @@ void UnitTestExponentialTransformUpdate(EtNormalizeType norm_type,
<< like_tot;
last_like_tot = like_tot;
}
int32 num_params = nblocks*( 1 + (norm_type== kEtNormalizeMeanAndVar ? 2*dim :
norm_type == kEtNormalizeMean ? dim : 0))
int32 num_params = nblocks*( 1 + (norm_type== kEtNormalizeDiag ? 2*dim :
norm_type == kEtNormalizeOffset ? dim : 0))
+ (update_a ? dim*(dim+1) : 0)
+ (update_b ? dim*dim : 0);
@ -212,10 +212,10 @@ int main() {
for (int i = 0; i < (long_test ? 5 : 1); i++) {
for (int j = 0; j < 2; j++) {
for (int k = 0; k < 2; k++) {
UnitTestExponentialTransformUpdate(kEtNormalizeMean, j != 0, k != 0);
UnitTestExponentialTransformUpdate(kEtNormalizeOffset, j != 0, k != 0);
if ((j != 0 && k != 0) || long_test) { // trying only a subset of these tests as it's taking
// too long
UnitTestExponentialTransformUpdate(kEtNormalizeMeanAndVar, j != 0, k != 0);
UnitTestExponentialTransformUpdate(kEtNormalizeDiag, j != 0, k != 0);
UnitTestExponentialTransformUpdate(kEtNormalizeNone, j != 0, k != 0);
}
}

Просмотреть файл

@ -245,12 +245,12 @@ ComputeTransform(const FmllrDiagGmmAccs &accs_in,
Ds_new.SetUnit();
BaseFloat objf_impr;
if (norm_type_ == kEtNormalizeMean) {
if (norm_type_ == kEtNormalizeOffset) {
objf_impr = ComputeFmllrMatrixDiagGmmOffset(Ds_new,
accs,
&Ds_new);
} else {
KALDI_ASSERT(norm_type_ == kEtNormalizeMeanAndVar);
KALDI_ASSERT(norm_type_ == kEtNormalizeDiag);
objf_impr = ComputeFmllrMatrixDiagGmmDiagonal(Ds_new,
accs,
&Ds_new);
@ -483,8 +483,8 @@ void ExponentialTransformAccsA::Read(std::istream &os, bool binary, bool add) {
void ExponentialTransform::SetNormalizeType(EtNormalizeType norm_type) {
if ((norm_type_ == kEtNormalizeMeanAndVar && norm_type != kEtNormalizeMeanAndVar)
||( norm_type_ == kEtNormalizeMean && norm_type == kEtNormalizeNone))
if ((norm_type_ == kEtNormalizeDiag && norm_type != kEtNormalizeDiag)
||( norm_type_ == kEtNormalizeOffset && norm_type == kEtNormalizeNone))
KALDI_ERR << "SetNormalizeType: trying to reduce the amount of normalization "
<< "(may not be consistent with transform estimation). ";
norm_type_ = norm_type;

Просмотреть файл

@ -37,8 +37,8 @@ namespace kaldi {
enum EtNormalizeType {
kEtNormalizeMean,
kEtNormalizeMeanAndVar,
kEtNormalizeOffset,
kEtNormalizeDiag,
kEtNormalizeNone
};
@ -65,8 +65,8 @@ class ExponentialTransform {
// are of dimension dim+1
// SetNormalizeType sets the normalization type to this. But it only allows
// you to increase the normalization type, i.e. None->Mean or MeanAndVar,
// or Mean->MeanAndVar.
// you to increase the normalization type, i.e. None->Offset or Diag
// or Offset->Diag
void SetNormalizeType(EtNormalizeType norm_type);
// ComputeTransform does not attempt to work out the objective function change,
@ -82,9 +82,10 @@ class ExponentialTransform {
int32 Dim() const { return A_.NumRows() - 1; } // returns feature dim.
// Ds is the first term in
// fmllr_mat = W_s = D_s exp(t_s A) B, which is a diagonal-only fMLLR (or possibly
// fmllr_mat = W_s = D_s exp(t_s A) B, which is a diagonal-only
// fMLLR (or possibly
// just mean-offset or [ I; 0 ], depending on whether norm_type_ is
// {MeanAndVar, Mean, None}.
// {Diag, Offset, None}.
void Write(std::ostream &os, bool binary) const;