Menu

hypseg param not working in sphinx3_align

Help
2011-06-23
2012-09-22
  • Pranav Jawale

    Pranav Jawale - 2011-06-23

    Hello,

    I built sphinx3 from SVN, (downloaded on 9th March). I am using sphinx3_align
    with -hypseg parameter

    INFO: cmd_ln.c(512): Parsing command line:
    ..\sphinx3_align \
        -hmm E:\users\pranav\sphinx\sphinxtest\test1\hmm1 \
        -dict E:\users\pranav\sphinx\sphinxtest\test1\lm1\test1.dic.txt \
        -fdict E:\users\pranav\sphinx\sphinxtest\test1\lm1\test1.filler.txt \
        -hyp E:\users\pranav\sphinx\sphinxtest\test1\hypseg.out.txt \
        -hypseg E:\users\pranav\sphinx\sphinxtest\test1\hypseg_align.txt \
        -cepdir E:\users\pranav\sphinx\sphinxtest\test1\feats \
        -cepext .mfc \
        -ceplen 13 \
        -frate 100 \
        -ctl E:\users\pranav\sphinx\sphinxtest\test1\list_one \
        -debug 3 \
        -insert_sil 0 \
        -insent E:\users\pranav\sphinx\sphinxtest\test1\insent.txt \
        -outsent E:\users\pranav\sphinx\sphinxtest\test1\outsent.txt \
        -phlabdir E:\users\pranav\sphinx\sphinxtest\test1 \
        -stsegdir E:\users\pranav\sphinx\sphinxtest\test1 \
        -s2stsegdir E:\users\pranav\sphinx\sphinxtest\test1 \
        -wdsegdir E:\users\pranav\sphinx\sphinxtest\test1 \
        -phsegdir E:\users\pranav\sphinx\sphinxtest\test1
    

    But the hypseg file is never created. Also in the sourcecode I could not find
    section where writing hypseg job is done (like the one in sphinx3_decode). Is
    this param working fine with anyone?

    Thanks.

     
  • Pranav Jawale

    Pranav Jawale - 2011-06-23

    Actually I need unscaled acoustic scores, (that's why I was going for hypseg)
    and I'm not sure whether the scores given in wdseg files have been unscaled or
    not (there is no -hypsegscore_unscale option in sphinx3_align).

     
  • Nickolay V. Shmyrev

    Hello

    wdseg is unscaled.

     
  • Pranav Jawale

    Pranav Jawale - 2011-06-25

    Thanks.

     
  • Pranav Jawale

    Pranav Jawale - 2011-06-25

    Hello,

    I did one test. I compared the decode acoustic scores with align scores. When
    I keep -hypsegscore_unscale no only then the decoder score is near to the
    align score

    Decoder ASCR for a word (with -hypsegscore_unscale yes) = 993077
    Decoder ASCR for the same word (with -hypsegscore_unscale no) = -902992
    Align score from wdseg = -913451
    I added following code to write_stseg function

            mdef_phone_str(kbc->mdef, stseg->pid, str2);
    
            fprintf(fp, "\nFrameIndex %d Phone %s PhoneID %d SenoneID %d state %d Ascr %11d \n",i,str2,stseg->pid,stseg->sen,stseg->state,stseg->score);
    

    str2 was defined as char str2; by me

    Some example lines which were created in stseg file were -

    FrameIndex 0 Phone SIL PhoneID 18 SenoneID 54 state 0 Ascr           0
    
    FrameIndex 1 Phone SIL PhoneID 18 SenoneID 55 state 1 Ascr      -29907
    
    FrameIndex 2 Phone SIL PhoneID 18 SenoneID 56 state 2 Ascr      -35769
    
    FrameIndex 3 Phone a PhoneID 19 SenoneID 57 state 0 Ascr      -12950
    
    FrameIndex 4 Phone a PhoneID 19 SenoneID 57 state 0 Ascr      -16943
    
    FrameIndex 5 Phone a PhoneID 19 SenoneID 57 state 0 Ascr      -18500
    
    FrameIndex 6 Phone a PhoneID 19 SenoneID 57 state 0 Ascr       -9099
    

    And in wdseg I have

         SFrm  EFrm    SegAScr Word
            0     2     -65676 <s>
            3    91    -913451 ananasa
           92    96     -91163 </s>
     Total score:    -1070290
    

    The sum of acoustic scores of states of first 3 frames ( 0 -29907 -35769) is
    exactly equal to wdseg of . Same thing happens for the second word.

    As all the state level scores are negative, I think scaling by the best senone
    is not undone anywhere in the code.

    These were the best senone scores for the first 3 frames-

    NumFrame 97
    0 28088
    1 -24821
    2 -36011
    
     
  • Pranav Jawale

    Pranav Jawale - 2011-06-25

    Update: It seems there are two kinds of scalings used in sphinx3_align

    1. scaling senone scores with best senone scores in the frames
    2. scaling by 'bestscore' in a frame - in align_frame() relevant code is
        s->newscore -= bestscore;   /* Scale, to avoid underflow */
      

    Only second kind of scaling is undone in build_stseg() . The code is

      stseg->score = h->score - prevscr + score_scale[f];
    

    In order to make the scores compatiable with decoder unscaled scores further
    unscaling will be reqd I guess.

     
  • Pranav Jawale

    Pranav Jawale - 2011-06-25

    It may be possible to unscale wrt best senones by keeping track of
    ascr->cache_best_list and using it when the stseg scores are updated in
    backtrace (build_stseg, build_phseg, build_wdseg etc.). I tried it but it gave
    some other error (somehow stseg->pid was assigned a very high value, assertion
    failed at one place). Anyway, it can be fixed I guess if somebody needs ..

     

Log in to post a comment.