Menu

Using Nbest crashes Windows Phone example

Help
Toine db
2016-02-26
2016-03-04
  • Toine db

    Toine db - 2016-02-26

    I'm trying to implement NBest output as an extension for the Windows example but App keeps crashing when using "ps_nbest", "ps_nbest_next" and "ps_nbest_hyp". But the App keeps crashing when these methods are used!

    I didn't use or create any special things, its almost an exact copy of the write_nbest() from PocketSphinx_Batch.
    I'm testing it on a WindowsPhone with the digits.gram, that works fine when only using ps_get_hyp.

    Are there any known issues with ps_nbest and pocketsphinx in Windows platform???

    the code I added for nBest, with this the Apps crashes

    ps_nbest_t *nbest;
            int32 i, n, score;
            const char* nbestHypothesis;
    
            auto nbestResults = ref new Vector<Platform::String^>();
            n = 5;
    
            nbest = ps_nbest(decoder);
            for (i = 0; i < n && nbest && (nbest = ps_nbest_next(nbest)); i++)
            {
                nbestHypothesis = ps_nbest_hyp(nbest, &score);
                auto nbestHyp = convertCharsToString(nbestHypothesis);
                nbestResults->Append(nbestHyp);
            }
    
            if (nbest)
            {
                ps_nbest_free(nbest);
            }
    
            OnNbestResultFinalizedBySilence(nbestResults);
    

    PS: When (quickly) debugging I seen that it passes through "ps_nbest" the first time, but with a very long dela(10 seconds) and the second time it uses "ps_nbest" the app crashes. I'll try to get more logs when my system is up and running again.

     
    • Toine db

      Toine db - 2016-02-28

      I have done some debugging and the first thing I notice is that nbest = ps_nbest(ps); takes more then 5 seconds, when decoded a simple digit.

      How can nBest be so slow on a Phone, while PocketSphinx_Batch does this within miliseconds?

      FYI: I solved/found the crash source, turns out that ps_nbest_hyp() sometimes returns a NULL that I didn't expect.

       

      Last edit: Toine db 2016-02-28
      • Nickolay V. Shmyrev

        Nbest speed depends on lattice size. If lattice is huge it may take quite some time. Lattice size is printed in the log and controlled by beam parameters.

         
        • Toine db

          Toine db - 2016-02-29

          OK, thanks for the reply.

          I'll try something else as well; if the nbest is faster when using complete audio bytes for a single utterance (like ps_batch), instead of continously reporting audio bytes like currently is done in the example (like ps_continous).

           

          Last edit: Toine db 2016-02-29
        • Toine db

          Toine db - 2016-03-04

          Again thanks for you support.

          I added NBest example to the Windows Phone project.
          https://github.com/cmusphinx/pocketsphinx-wp-demo/pull/5

          It includes a lot readbility improvements and cleanup and memory leak fixes etc.

          PS: working on antother Pull request to improve the Struct used by the interface.
          (instead of string thats needs to be split)

           

Log in to post a comment.