源码阅读|Kaldi中的PLDA打分
# ivector-plda-scoring
用PLDA模型计算trials文件的log似然率,trials文件应有如下格式:<key1> <key2>
,输出文件应有如下格式:<key1> <key2> [<dot-product>]
,如果key无法被找到,该程序会给出warning警告。对于训练样本,输入的是每个spk的平均Ivector,--num-utts
包含了每个人的utt数,该参数影响了PLDA打分(如果未提供,默认1utt/spk)
Usage: ivector-plda-scoring <plda> <train-ivector-rspecifier> <test-ivector-rspecifier>
<trials-rxfilename> <scores-wxfilename>
e.g.: ivector-plda-scoring --num-utts=ark:exp/train/num_utts.ark plda ark:exp/train/spk_ivectors.ark ark:exp/test/ivectors.ark trials scores
See also: ivector-compute-dot-products, ivector-compute-plda
Options:
--normalize-length: If true, do length normalization as part of PLDA (see code for details). This does not set the length unit; by default it instead ensures that the inner product with the PLDA model's inverse variance (which is a function of how many utterances the iVector was averaged over) has the expected value, equal to the iVector dimension. (bool, default = true)
--num-utts: Table to read the number of utterances per speaker, e.g. ark:num_utts.ark (string, default = "")
--simple-length-normalization : If true, replace the default length normalization by an alternative that normalizes the length of the iVectors to be equal to the square root of the iVector dimension. (bool, default = false)
2
3
4
5
6
7
8
9
10
# ivector-copy-plda
复制一个PLDA对象,可能对类内协方差应用平滑smoothing
Usage: ivector-copy-plda <plda-in> <plda-out>
e.g.: ivector-copy-plda --smoothing=0.1 plda plda.smooth0.1
Options:
--binary: Write output in binary mode (bool, default = true)
--normalize-length: If true, do length normalization as part of PLDA (see code for details). This does not set the length unit; by default it instead ensures that the inner product with the PLDA model's inverse variance (which is a function of how many utterances the iVector was averaged over) has the expected value, equal to the iVector dimension. (bool, default = true)
--simple-length-normalization : If true, replace the default length normalization by an alternative that normalizes the length of the iVectors to be equal to the square root of the iVector dimension. (bool, default = false)
--smoothing : Factor used in smoothing within-class covariance (add this factor times between-class covar) (float, default = 0)
2
3
4
5
6
7
8
# ivector-mean
给定3~4个参数,对spk2utt中每个spk的所有utt的Ivector取均值。输入:spk2utt,由utt索引的一组Ivector;输出:由spk索引的Ivector。如果给了4个参数,就是每个spk对应的utt数的表格;如果只给了2个参数,就是求所有输入文件的均值,并写出均值向量。
Usage: ivector-mean <spk2utt-rspecifier> <ivector-rspecifier> <ivector-wspecifier> [<num-utt-wspecifier>]
or: ivector-mean <ivector-rspecifier> <mean-wxfilename>
e.g.: ivector-mean data/spk2utt exp/ivectors.ark exp/spk_ivectors.ark exp/spk_num_utts.ark
or: ivector-mean exp/ivectors.ark exp/mean.vec
See also: ivector-subtract-global-mean
Options:
--binary: If true, write output in binary (only applicable when writing files, not archives/tables. (bool, default = false)
2
3
4
5
6
7
8
# ivector-subtract-global-mean
复制去除均值后的Ivector,第一个参数用于指定均值向量,否则使用输入Ivector的总和?
Usage: ivector-subtract-global-mean <ivector-rspecifier> <ivector-wspecifier>
or: ivector-subtract-global-mean <mean-rxfliename> <ivector-rspecifier> <ivector-wspecifier>
e.g.: ivector-subtract-global-mean scp:ivectors.scp ark:-
or: ivector-subtract-global-mean mean.vec scp:ivectors.scp ark:-
See also: ivector-mean
Options:
--subtract-mean: If true, subtract mean; if false, just copy the input. (bool, default = true)
2
3
4
5
6
7
8
# transform-vec
对独立的向量进行线性/仿射变换,如,Ivector。类似于transform-feats,比起作用于矩阵,该函数作用于向量,并且是单个变换矩阵,而不是变换矩阵表。
Usage: transform-vec [options] <transform-rxfilename> <feats-rspecifier> <feats-wspecifier>
See also: transform-feats, est-pca
2
# ivector-normalize-length
将Ivector长度归一化为sqrt(特征维数)?
Usage: ivector-normalize-length [options] <ivector-rspecifier> <ivector-wspecifier>
e.g.:
ivector-normalize-length ark:ivectors.ark ark:normalized_ivectors.ark
2
3
# 补充说明
# transform-feats
应用变化(e.g. LDA; HLDA; fMLLR/CMLLR; MLLT/STC)。当transform-num-cols == feature-dim时,为线性变换,当transform-num-cols == feature-dim+1 (->append 1.0 to features)时,为仿射变换。默认作用于每个utt,当utt2spk文件提供时,可作用于每个spk。若提供了transform-rxfilename,则作用于全局。
Usage: transform-feats [options] (<transform-rspecifier>|<transform-rxfilename>) <feats-rspecifier> <feats-wspecifier>
See also: transform-vec, copy-feats, compose-transforms
2