【问题标题】:MFCC data format to train HMM用于训练 HMM 的 MFCC 数据格式
【发布时间】:2012-06-10 20:23:43
【问题描述】:

我正在尝试使用 mfcc 功能和隐藏马尔可夫模型在 java 中开发一个音频分类系统。我正在关注这篇研究论文:http://acccn.net/cr569/Rstuff/keys/bathSoundMonitoring.pdf

算法描述如下:

每个声音文件,对应一个声音事件的样本,在 具有重叠的汉明窗 (25 ms) 预先强调和加窗的帧 50%。由 13 阶 MFCC 组成的特征向量 框架。我们使用从左到右的六态连续密度对每个声音进行建模 没有状态跳过的 HMM。每个 HMM 状态由两个高斯混合组成 成分。完成模型初始化阶段后,所有 HMM 模型 在三个迭代周期中进行训练。

我已经完成了第一部分工作,即从样本声音中提取特征。结果,我得到了一个二维数组,每行包含 13 列(每行代表声音的一帧)。 现在我的问题是如何使用这些数据训练 hmm。

我正在使用 jahmm 库。到目前为止,我已经开发了一些示例代码来大致了解该库的工作原理。

/**Some sample data to act as the mfcc data. Here each line terminated by a new space
     * is one observation. I don't know whether each line should be one row from the mfcc values 
     * (representing one frame) or each line should be representing a set of features from one audio file.
     */
    String realSequences = "1.1;2.2;3.3;4.4;5.5;6.6;7.7;8.8;9.9;10.0;11.1;12.2;13.3;\n"
            + "1.1;2.2;3.3;4.4;5.5;6.6;7.7;8.8;9.9;10.0;11.1;12.2;13.3;\n"
            + "1.1;2.2;3.3;4.4;5.5;6.6;7.7;8.8;9.9;10.0;11.1;12.2;13.3;\n"
            + "1.1;2.2;3.3;4.4;5.5;6.6;7.7;8.8;9.9;10.0;11.1;12.2;13.3;\n"
            + "1.1;2.2;3.3;4.4;5.5;6.6;7.7;8.8;9.9;10.0;11.1;12.2;13.3;\n"
            + "1.1;2.2;3.3;4.4;5.5;6.6;7.7;8.8;9.9;10.0;11.1;12.2;13.3;\n"
            + "1.1;2.2;3.3;4.4;5.5;6.6;7.7;8.8;9.9;10.0;11.1;12.2;13.3;\n"
            + "1.1;2.2;3.3;4.4;5.5;6.6;7.7;8.8;9.9;10.0;11.1;12.2;13.3;\n"
            + "1.1;2.2;3.3;4.4;5.5;6.6;7.7;8.8;9.9;10.0;11.1;12.2;13.3;\n"
            + "1.1;2.2;3.3;4.4;5.5;6.6;7.7;8.8;9.9;10.0;11.1;12.2;13.3;\n"
            + "1.1;2.2;3.3;4.4;5.5;6.6;7.7;8.8;9.9;10.0;11.1;12.2;13.3;\n"
            + "1.1;2.2;3.3;4.4;5.5;6.6;7.7;8.8;9.9;10.0;11.1;12.2;13.3;\n"
            + "1.1;2.2;3.3;4.4;5.5;6.6;7.7;8.8;9.9;10.0;11.1;12.2;13.3;\n"
            + "1.1;2.2;3.3;4.4;5.5;6.6;7.7;8.8;9.9;10.0;11.1;12.2;13.3;\n"
            + "1.1;2.2;3.3;4.4;5.5;6.6;7.7;8.8;9.9;10.0;11.1;12.2;13.3;\n"
            + "1.1;2.2;3.3;4.4;5.5;6.6;7.7;8.8;9.9;10.0;11.1;12.2;13.3;\n"
            + "1.1;2.2;3.3;4.4;5.5;6.6;7.7;8.8;9.9;10.0;11.1;12.2;13.3;\n"
            + "1.1;2.2;3.3;4.4;5.5;6.6;7.7;8.8;9.9;10.0;11.1;12.2;13.3;\n"
            + "1.1;2.2;3.3;4.4;5.5;6.6;7.7;8.8;9.9;10.0;11.1;12.2;13.3;\n"
            + "1.1;2.2;3.3;4.4;5.5;6.6;7.7;8.8;9.9;10.0;11.1;12.2;13.3;\n"
            + "1.1;2.2;3.3;4.4;5.5;6.6;7.7;8.8;9.9;10.0;11.1;12.2;13.3;\n";


    /**
     * This is the reader class that reads the data and puts then in a relevant collection format
     * 
     */
    Reader reader = new StringReader(realSequences);
    List<? extends List<ObservationReal>> sequences =
            ObservationSequencesReader.readSequences(new ObservationRealReader(), reader);
    reader.close();


    /**
     * As the description states that each state is composed of two Gaussian mixture components.
     */
    OpdfGaussianMixtureFactory gMixtureFactory = new OpdfGaussianMixtureFactory(2);

    /**
     * The manual for jahmm says that KMeans learner is a good way to initialize the hmm. It has 6 states
     * and uses the two gaussian mixture models created above.
     */
    KMeansLearner<ObservationReal> kml = new KMeansLearner<ObservationReal>(6, gMixtureFactory, sequences);
    Hmm<ObservationReal> initHmm = kml.iterate();


    /*
     * As the papers states the hmm is trained in 3 iterative cycles.
     */
    BaumWelchLearner bwl = new BaumWelchLearner();
    Hmm<ObservationReal> learntHmm = null;
    for (int i = 0; i < 3; i++) {
        learntHmm = bwl.iterate(initHmm, sequences);
    }

我的问题是:

Q1:mfcc 数据应该以什么格式传递来训练 hmm? (通过 realSeuqences 线查看 cmets)

Q2:在语音识别中,有时我们需要通过重复同一个单词来训练系统,让我们说 10 次。这是否意味着它用这 10 个样本训练了一个 hmm?如果是,那么如何用相同声音的不同样本训练一个 hmm。或者是 10 个单独训练的 hmm 但标有那个词?

Q3:如何在声音识别方面比较两个 hmm 模型。使用 viterbi 或 Kullback Leibler Distance 哪个更好?

【问题讨论】:

    标签: java signal-processing speech-recognition hidden-markov-models


    【解决方案1】:

    Q1:mfcc 数据应该以什么格式传递来训练 hmm? (通过 realSeuqences 线查看 cmets)

    MFCC 数据必须表示为:

    List<? extends List<ObservationVector>> sequences
    

    这是一个数据序列列表。每个序列对应一个词样本,是一个向量列表,每个向量代表一个帧,包含 13 个 MFCC 值。

    Q2:在语音识别中,有时我们需要通过以下方式训练系统 重复同一个词让我们说 10 次。这是否意味着它训练一个 嗯,那 10 个样本?

    输入数据是每个单词的序列列表。这个列表是一起处理的。

    如果是,那么如何训练一个嗯 相同声音的不同样本。还是10个单独训练的 嗯,但标有那个词?

    这是一个 HMM。 hmm 训练算法适用于每个单词的多个样本。它实际上需要相当多的样本,超过 10 个。

    Q3:如何在声音识别方面比较两个 hmm 模型。是吗 最好使用 viterbi 或 Kullback Leibler 距离?

    这里的“比较”是什么意思还不太清楚。您是否希望一个 HMM 的状态比另一个少,或者是什么。你想用什么属性来比较。答案取决于那个。

    而且,重要的是要注意语音识别 HMM 训练有一些特定的(如何选择状态数、要使用哪些功能、如何初始化 HMM)。出于这个原因,为了获得最佳性能,最好使用专门的工具包,如 CMUSphinx (http://cmusphinx.sourceforge.net),而不是通用工具包。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-07-30
      • 2017-06-27
      • 2014-06-08
      • 2014-02-05
      • 2013-03-04
      • 1970-01-01
      • 2015-11-14
      相关资源
      最近更新 更多