gpt4 book ai didi

java - Sphinx 4可怕的准确性

转载 作者:太空宇宙 更新时间:2023-11-04 11:10:02 28 4
gpt4 key购买 nike

我正在尝试让 sphinx 4 与我的桌面应用程序一起工作,它的正确率是 0%我还使用默认语言模型以及 sphinx4 data.jar 中的所有内容

代码:

import edu.cmu.sphinx.api.Configuration;
import edu.cmu.sphinx.api.Microphone;
import edu.cmu.sphinx.api.SpeechResult;
import edu.cmu.sphinx.api.StreamSpeechRecognizer;
public class Speechy {
public static void main(String[] args) throws Exception {

Configuration configuration = new Configuration();

configuration.setAcousticModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us");
configuration.setDictionaryPath("resource:/edu/cmu/sphinx/models/en-us/cmudict-en-us.dict");
configuration.setLanguageModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us.lm.bin");
Microphone micro = new Microphone(8000, 16, true, false);
micro.startRecording();
StreamSpeechRecognizer recognizer = new StreamSpeechRecognizer(configuration);
// Start recognition process pruning previously cached data.
recognizer.startRecognition(micro.getStream());
while(true){
SpeechResult result = recognizer.getResult();
System.out.println(result.getHypothesis());
}
}
}

最佳答案

Microphone micro = new Microphone(8000, 16, true, false);

默认声学模型需要16khz音频,您的配置8000是错误的。

另请参阅the tutorial

The top reasons of the bad accuracy are:

The mismatch of the sample rate/no. of channels of the incoming audio or the mismatch of the incoming audio bandwidth. It must be 16kHz (or 8kHz, depending on the training data) 16bit Mono (= single channel) Little-Endian file. You need to fix sample rate of the source with resampling (only if its rate is higher than that of the training data). You should not upsample a file and decode it with acoustic models trained on higher sampling rate audio. Audio file format (sampling rate, number of channels) can be verified using below command sox --i /path/to/audio/file. Find more information here: What is sample rate

关于java - Sphinx 4可怕的准确性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46124023/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com