通过将wav转换为倒谱引起的Shpinx 4关键字定位功能的低精度

时间:2012-10-30 11:47:08

标签: java speech-recognition cmusphinx

我正在尝试构建一个关键字定位系统,我选择this(sphinx 4的一个分支)作为我项目的基础。

它适用于wav文件(使用单个关键字至少70%)。但是为了节省从客户端到服务器传输文件的时间,我决定首先在客户端将wav文件转换为cepstrum,然后只传输倒谱。这项工作由Featurefiledumper执行。

但是当将倒谱加载到原始的KWS系统时,准确性非常糟糕。我以为我只是在客户端放了一些作品,它不应该影响准确性。原始KWS系统可以将每个单词拆分成适当的块然后识别。使用频谱作为输入后,系统甚至无法正确分割每个单词。我认为这也是它无法实现高精度的原因。

我想找到一种方法来节省传输文件的时间,并且仍然具有合理的KWS系统准确性。是否有任何我错过的配置或有另一种方法来满足需求?

以下是客户端的配置:

<config>

<!-- ******************************************************** -->
<!-- The frontend configuration                               -->
<!-- ******************************************************** -->

<component name="cepstraFrontEnd" type="edu.cmu.sphinx.frontend.FrontEnd">
    <propertylist name="pipeline">
        <item>streamDataSource</item>
        <item>preemphasizer</item>
        <item>windower</item>
        <item>fft</item>
        <item>melFilterBank</item>
        <item>dct</item>
    </propertylist>
</component>

<component name="preemphasizer"
           type="edu.cmu.sphinx.frontend.filter.Preemphasizer"/>

<component name="windower"
           type="edu.cmu.sphinx.frontend.window.RaisedCosineWindower">
</componentcomponent>

<component name="fft"
           type="edu.cmu.sphinx.frontend.transform.DiscreteFourierTransform"/>

<component name="melFilterBank"
           type="edu.cmu.sphinx.frontend.frequencywarp.MelFrequencyFilterBank">
</component>

<component name="dct"
           type="edu.cmu.sphinx.frontend.transform.DiscreteCosineTransform"/>

<component name="streamDataSource"
           type="edu.cmu.sphinx.frontend.util.StreamDataSource">
    <property name="sampleRate" value="16000"/>
</component>

</config>

以下是服务器端的配置:

<config>

<property name="logLevel" value="WARNING" />
<property name="absoluteBeamWidth" value="-1" />
<property name="relativeBeamWidth" value="1E-150" />
<property name="wordInsertionProbability" value="0.7" />
<property name="languageWeight" value="7" />

<property name="frontend" value="epFrontEnd" />
<property name="recognizer" value="recognizer" />
<property name="showCreations" value="false" />
<property name="outOfGrammarProbability" value="1E-10"/>
<property name="phoneInsertionProbability" value="1E-55"/>  
<component name="recognizer" type="edu.cmu.sphinx.recognizer.Recognizer">
    <property name="decoder" value="decoder" />
</component>

<component name="decoder" type="edu.cmu.sphinx.decoder.Decoder">
    <property name="searchManager" value="searchManager" />
</component>

<component name="searchManager" type="edu.cmu.sphinx.decoder.search.SimpleBreadthFirstSearchManager">
    <property name="logMath" value="logMath" />
    <property name="linguist" value="FlatLinguist" />
    <property name="pruner" value="trivialPruner" />
    <property name="scorer" value="threadedScorer" />
    <property name="activeListFactory" value="activeList" />
</component>


<component name="activeList" type="edu.cmu.sphinx.decoder.search.PartitionActiveListFactory">
    <property name="logMath" value="logMath" />
    <property name="absoluteBeamWidth" value="${absoluteBeamWidth}" />
    <property name="relativeBeamWidth" value="${relativeBeamWidth}" />
</component>

<component name="trivialPruner" type="edu.cmu.sphinx.decoder.pruner.SimplePruner" />

<component name="threadedScorer" type="edu.cmu.sphinx.decoder.scorer.ThreadedAcousticScorer">
    <property name="frontend" value="${frontend}" />
</component>

<component name="FlatLinguist" type="edu.cmu.sphinx.linguist.KWSFlatLinguist.KWSFlatLinguist">
    <property name="logMath" value="logMath" />
    <property name="grammar" value="NoSkipGrammar" />
    <property name="acousticModel" value="wsj" />       
    <property name="wordInsertionProbability" value="${wordInsertionProbability}" />
    <property name="languageWeight" value="${languageWeight}" />
    <property name="unitManager" value="unitManager" /> 
    <property name="addOutOfGrammarBranch" value="true"/>
    <property name="phoneLoopAcousticModel" value="WSJ"/>
    <property name="outOfGrammarProbability" value="${outOfGrammarProbability}"/>
    <property name="phoneInsertionProbability" value="${phoneInsertionProbability}"/>
    <property name="dumpGStates" value ="true"/>    
</component>

<component name="NoSkipGrammar" type="edu.cmu.sphinx.linguist.language.grammar.NoSkipGrammar">
    <property name="dictionary" value="dictionary" />
    <property name="logMath" value="logMath" />
    <property name="addSilenceWords" value="false" />
</component>

<component name="dictionary" type="edu.cmu.sphinx.linguist.dictionary.AllWordDictionary">
    <property name="dictionaryPath" value="resource:/WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz/dict/cmudict.0.6d" />
    <property name="fillerPath" value="resource:/WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz/noisedict" />
    <property name="addSilEndingPronunciation" value="false" />
    <property name="wordReplacement" value="&lt;sil&gt;" />
    <property name="unitManager" value="unitManager" />
</component>

<component name="wsj" type="edu.cmu.sphinx.linguist.acoustic.tiedstate.TiedStateAcousticModel">
    <property name="loader" value="wsjLoader" />
    <property name="unitManager" value="unitManager" />
</component>

<component name="wsjLoader" type="edu.cmu.sphinx.linguist.acoustic.tiedstate.Sphinx3Loader">
    <property name="logMath" value="logMath" />
    <property name="unitManager" value="unitManager" />
    <property name="location" value="resource:/WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz" />
</component>

<component name="unitManager" type="edu.cmu.sphinx.linguist.acoustic.UnitManager" />
<!-- additions start-->
<component name="WSJ" type="edu.cmu.sphinx.linguist.acoustic.tiedstate.TiedStateAcousticModel">
    <property name="loader" value="WSJLOADER" />
    <property name="unitManager" value="UNITMANAGER" />
</component>

<component name="WSJLOADER" type="edu.cmu.sphinx.linguist.acoustic.tiedstate.Sphinx3Loader">
    <property name="logMath" value="logMath" />
    <property name="unitManager" value="UNITMANAGER" />
    <property name="location" value="resource:/WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz" />
</component>

<component name="UNITMANAGER" type="edu.cmu.sphinx.linguist.acoustic.UnitManager" />

<component name="tidigits" 
  type="edu.cmu.sphinx.model.acoustic.TIDIGITS_8gau_13dCep_16k_40mel_130Hz_6800Hz.Model">
    <property name="loader" value="sphinx3Loader"/>
    <property name="unitManager" value="unitManager"/>
</component>

<component name="sphinx3Loader"
           type="edu.cmu.sphinx.model.acoustic.TIDIGITS_8gau_13dCep_16k_40mel_130Hz_6800Hz.ModelLoader">
    <property name="logMath" value="logMath"/>
    <property name="unitManager" value="UNITMANAGER"/>
</component>
<!-- additions end -->

<component name="epFrontEnd" type="edu.cmu.sphinx.frontend.FrontEnd">
    <propertylist name="pipeline">
        <item>streamCepstrumSource </item>
        <item>BatchCMN </item>
        <item>featureExtraction </item>
    </propertylist>
</component>

<component name="audioFileDataSource" type="edu.cmu.sphinx.frontend.util.AudioFileDataSource" />

<component name="dataBlocker" type="edu.cmu.sphinx.frontend.DataBlocker" />

<component name="speechClassifier" type="edu.cmu.sphinx.frontend.endpoint.SpeechClassifier" />

<component name="nonSpeechDataFilter" type="edu.cmu.sphinx.frontend.endpoint.NonSpeechDataFilter" />

<component name="speechMarker" type="edu.cmu.sphinx.frontend.endpoint.SpeechMarker" />

<component name="preemphasizer" type="edu.cmu.sphinx.frontend.filter.Preemphasizer" />

<component name="windower" type="edu.cmu.sphinx.frontend.window.RaisedCosineWindower">
</component>

<component name="fft" type="edu.cmu.sphinx.frontend.transform.DiscreteFourierTransform">
</component>

<component name="melFilterBank" type="edu.cmu.sphinx.frontend.frequencywarp.MelFrequencyFilterBank">
</component>

<component name="dct" type="edu.cmu.sphinx.frontend.transform.DiscreteCosineTransform" />

<component name="liveCMN" type="edu.cmu.sphinx.frontend.feature.LiveCMN" />

<component name="featureExtraction" type="edu.cmu.sphinx.frontend.feature.DeltasFeatureExtractor" />

<component name="BatchCMN" type="edu.cmu.sphinx.frontend.feature.BatchCMN"/>

<component name="logMath" type="edu.cmu.sphinx.util.LogMath">
    <property name="logBase" value="1.0001" />
    <property name="useAddTable" value="true" />
</component>

<component name="streamCepstrumSource" type="edu.cmu.sphinx.frontend.util.StreamCepstrumSource">
    <property name="sampleRate" value="16000"/>
    </component>

</config>      

=============================================== ===================

感谢尼古拉。我已经弄清楚原因是不同的组件(StreamDataSource和AudioFileDataSource)来处理文件。

但是有一个问题,我的客户端是Android系统。它不支持javax.sound.sampled类。所以我的客户端无法使用AudioFileDataSource。 StreamDataSource是一种可能的解决方案。但我不知道为什么这两个组件导致不同的功能集。

是否有提示使StreamDataSource生成与AudioFileDataSource相同的结果?

1 个答案:

答案 0 :(得分:1)

  

我在配置中是否有任何遗漏,或者有另一种方法   满足需要?

配置正确,你没有错过任何东西。

你最有可能在你自己写的转移函数中犯了错误。您需要首先尝试将数据作为文件传输,以确保所有内容都相同。您还可以转储CepstrumDataSource生成的值,以验证它们是否在预期范围内。您可以使用DataDumper组件。