Menu

Need help with LiveSpeechRecognizer

2014-09-25
2014-09-25
  • August Retumban

    August Retumban - 2014-09-25

    Hi. Im using the current sphinx4-5prealpha and I'm trying to get a hang of it. My aim is to create a speech to text program using sphinx and I am using the en-us acoustic model, en-us-lm as language model, and cmu07a as dictionary. The program runs but the thing is that it doesn't show results and after a few minutes it just runs out of memory. I have allocated memory for it just like the transcriber demo. Here is my code:

    import java.net.URL;
    import edu.cmu.sphinx.api.Configuration;
    import edu.cmu.sphinx.api.Context;
    import edu.cmu.sphinx.api.Microphone;
    import edu.cmu.sphinx.api.SpeechResult;
    import edu.cmu.sphinx.recognizer.Recognizer;
    import edu.cmu.sphinx.result.WordResult;
    import edu.cmu.sphinx.api.LiveSpeechRecognizer;
    public class TranscriberLive {
    public static void main(String[] args) throws Exception {

    System.out.println("Loading models...");
    
    Configuration configuration = new Configuration();
    configuration.setAcousticModelPath("resource:/en-us");
    
    configuration.setDictionaryPath("resource:/cmu07a.dic");
    
    configuration.setLanguageModelPath("src/cmusphinx-5.0-en-us.lm.dmp");
    LiveSpeechRecognizer recognizer= new LiveSpeechRecognizer(configuration);
    
    recognizer.startRecognition(true);
    System.out.println("Say Something:");
    
    SpeechResult result=recognizer.getResult();
    System.out.println(result.getHypothesis());
    recognizer.stopRecognition();
    

    }
    }

    This shows after 5 minutes or more after running the program.

    Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at edu.cmu.sphinx.decoder.search.WordPruningBreadthFirstSearchManager.collectSuccessorTokens(WordPruningBreadthFirstSearchManager.java:667)
    at edu.cmu.sphinx.decoder.search.WordPruningBreadthFirstSearchManager.growBranches(WordPruningBreadthFirstSearchManager.java:392)
    at edu.cmu.sphinx.decoder.search.WordPruningBreadthFirstSearchManager.growNonEmittingBranches(WordPruningBreadthFirstSearchManager.java:436)
    at edu.cmu.sphinx.decoder.search.WordPruningBreadthFirstSearchManager.recognize(WordPruningBreadthFirstSearchManager.java:308)
    at edu.cmu.sphinx.decoder.search.WordPruningBreadthFirstSearchManager.recognize(WordPruningBreadthFirstSearchManager.java:282)
    at edu.cmu.sphinx.decoder.Decoder.decode(Decoder.java:65)
    at edu.cmu.sphinx.recognizer.Recognizer.recognize(Recognizer.java:110)
    at edu.cmu.sphinx.recognizer.Recognizer.recognize(Recognizer.java:126)
    at edu.cmu.sphinx.api.AbstractSpeechRecognizer.getResult(AbstractSpeechRecognizer.java:50)
    at TranscriberLive.main(TranscriberLive.java:25)

    It doesn't show results and I'm stumped again. Any help will be much appreciated.

     
    • Nickolay V. Shmyrev

      You need to increase java heap memory. Such configuration requires about 2Gb of memory in heap.

       

Log in to post a comment.

Auth0 Logo