Menu

ngram_fwdtree_deinit can cause a divide by 0

Help
Allie
2018-11-16
2018-11-20
  • Allie

    Allie - 2018-11-16

    I was working on integrating pocketsphinx into our project, which more or less is working out well, however when I shut down pocketsphinx via ps_free, I get a crash in ngram_search_fwdtree.c in the function ngram_fwdtree_deinit(). In this function, ngs->n_tot_frame is 0 and thus the log infos that happen here break, since n_speech is 0.

    I imagine that this is caused by a bad configuration, but I am unsure what configuration option is missing or not set correctly. A weird note, -cmn is set to batch not current, I am not sure why the log says this. Additionally, noise suppression and silence detection are already detected by our code and the audio buffers passed to pocketsphinx have already been processed.

    In our codebase, pocketsphinx is wrapped by a c++ class that handles all interactions with the library. We are using PS to transcribe spoken words into text in a dictation rather than command words. We are also passing complete utterances to pocketsphinx in a separate thread for processing.

    Here is the log output:

    INFO: pocketsphinx.c(153): Parsed model-specific feature parameters from path/to/language/model/cmusphinx-en-us-5.2/feat.params
    Current configuration:
    [NAME]          [DEFLT]     [VALUE]
    -agc            none        none
    -agcthresh      2.0     2.000000e+00
    -allphone               
    -allphone_ci        yes     yes
    -alpha          0.97        9.700000e-01
    -ascale         20.0        2.000000e+01
    -aw         1       1
    -backtrace      no      no
    -beam           1e-48       1.000000e-48
    -bestpath       yes     yes
    -bestpathlw     9.5     9.500000e+00
    -ceplen         13      13
    -cmn            live        current
    -cmninit        40,3,-1     40,3,-1
    -compallsen     no      no
    -dict                   path/to/language/model/cmudict-en-us.dict
    -dictcase       no      no
    -dither         no      no
    -doublebw       no      no
    -ds         1       2
    -fdict                  
    -feat           1s_c_d_dd   1s_c_d_dd
    -featparams             
    -fillprob       1e-8        1.000000e-08
    -frate          100     100
    -fsg                    
    -fsgusealtpron      yes     yes
    -fsgusefiller       yes     yes
    -fwdflat        yes     yes
    -fwdflatbeam        1e-64       1.000000e-64
    -fwdflatefwid       4       4
    -fwdflatlw      8.5     8.500000e+00
    -fwdflatsfwin       25      25
    -fwdflatwbeam       7e-29       7.000000e-29
    -fwdtree        yes     yes
    -hmm                    path/to/language/model/cmusphinx-en-us-5.2
    -input_endian       little      little
    -jsgf                   
    -keyphrase              
    -kws                    
    -kws_delay      10      10
    -kws_plp        1e-1        1.000000e-01
    -kws_threshold      1e-30       1.000000e-30
    -latsize        5000        5000
    -lda                    
    -ldadim         0       0
    -lifter         0       22
    -lm                 path/to/language/model/en-70k-0.2.lm
    -lmctl                  
    -lmname                 
    -logbase        1.0001      1.000100e+00
    -logfn                  path/to/log/pocketsphinx.log
    -logspec        no      no
    -lowerf         133.33334   1.300000e+02
    -lpbeam         1e-40       1.000000e-40
    -lponlybeam     7e-29       7.000000e-29
    -lw         6.5     6.500000e+00
    -maxhmmpf       30000       30000
    -maxwpf         -1      -1
    -mdef                   
    -mean                   
    -mfclogdir              
    -min_endfr      0       0
    -mixw                   
    -mixwfloor      0.0000001   1.000000e-07
    -mllr                   
    -mmap           yes     yes
    -ncep           13      13
    -nfft           512     512
    -nfilt          40      25
    -nwpen          1.0     1.000000e+00
    -pbeam          1e-48       1.000000e-48
    -pip            1.0     1.000000e+00
    -pl_beam        1e-10       1.000000e-10
    -pl_pbeam       1e-10       1.000000e-10
    -pl_pip         1.0     1.000000e+00
    -pl_weight      3.0     3.000000e+00
    -pl_window      5       5
    -rawlogdir              
    -remove_dc      no      no
    -remove_noise       yes     no
    -remove_silence     yes     no
    -round_filters      yes     yes
    -samprate       16000       1.600000e+04
    -seed           -1      -1
    -sendump                
    -senlogdir              
    -senmgau                
    -silprob        0.005       5.000000e-03
    -smoothspec     no      no
    -svspec                 
    -tmat                   
    -tmatfloor      0.0001      1.000000e-04
    -topn           4       4
    -topn_beam      0       0
    -toprule                
    -transform      legacy      dct
    -unit_area      yes     yes
    -upperf         6855.4976   6.800000e+03
    -uw         1.0     1.000000e+00
    -vad_postspeech     50      50
    -vad_prespeech      20      20
    -vad_startspeech    10      10
    -vad_threshold      3.0     3.000000e+00
    -var                    
    -varfloor       0.0001      1.000000e-04
    -varnorm        no      no
    -verbose        no      no
    -warp_params                
    -warp_type      inverse_linear  inverse_linear
    -wbeam          7e-29       7.000000e-29
    -wip            0.65        6.500000e-01
    -wlen           0.025625    2.562500e-02
    
     
    • Nickolay V. Shmyrev

      You are welcome to add a check for 0 there and submit a pull request.

       
      • Allie

        Allie - 2018-11-19

        Of course ;) but what would cause this value to go to 0? And is that a bad thing (outside of this divide by 0 error)

         
        • Nickolay V. Shmyrev

          but what would cause this value to go to 0?

          If you destroy decoder after creation and process 0 frames the value is 0

          And is that a bad thing

          No

           
          • Allie

            Allie - 2018-11-20

            Awesome thanks for the info :)

             

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.