我正在尝试构建一个关键字定位系统,我选择这个sphinx 4 的一个分支作为我项目的基础。
它适用于 wav 文件(至少 70% 使用单个关键字)。但是为了节省将文件从客户端传输到服务器的时间,我决定先在客户端将 wav 文件转换为倒谱,然后再传输倒谱。这项工作由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="<sil>" />
<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)。
但是有个问题,我的客户端是安卓系统。它不支持 javax.sound.sampled 类。所以在我的客户端上使用 AudioFileDataSource 是不可能的。StreamDataSource 是一种可能的解决方案。但我不知道为什么这两个组件会导致不同的功能集。
是否有提示使 StreamDataSource 生成与 AudioFileDataSource 相同的结果?