Menu

feature extraction mismatch on Android application

Help
qiqi
2016-05-10
2016-05-12
  • qiqi

    qiqi - 2016-05-10

    Hi, Dear all,

    We are building an Android application with pocketsphinx on cellphone. However we find there is a problem in feature extraction.

    It seems there is mismatch in the values extracted in two places in the code:
    1). we get the feature matrix from the following place:
    In File pocketsphinx/src/libpocketsphinx/pocketsphinx.c,
    function ps_process_raw(),
    after running acmod_process_raw(),
    get array from ps->acmod->mfc_buf

    2). we get the .mfc file from the following place:
    recognizer = SpeechRecognizerSetup.defaultSetup()
    ...
    .setString("-mfclogdir", assetsDir.getPath())
    ...
    .getRecognizer();

    My understanding is that the two matrixes extraced from these two places should be same. However, we find there are totally different.

    Could anyone tell me if they should be different or did we make some mistake?

    Thank you.

     

    Last edit: qiqi 2016-05-10
    • Nickolay V. Shmyrev

      Without samples of your code it is hard to help you, I suspect you implemented something in 1) incorrectly.

       
      • qiqi

        qiqi - 2016-05-12

        Here is the code:

        int ps_process_raw(ps_decoder_t *ps,
                       int16 const *data,
                       size_t n_samples,
                       int no_search,
                       int full_utt) {
            int i, j;
            int n_searchfr = 0;
        
            if (ps->acmod->state == ACMOD_IDLE) {
            E_ERROR("Failed to process data, utterance is not started. Use start_utt to start it\n");
            return 0;
            }
        
            if (no_search)
                acmod_set_grow(ps->acmod, TRUE);
        
            while (n_samples) {
                int nfr;
        
                /* Process some data into features. */
                if ((nfr = acmod_process_raw(ps->acmod, &data,
                                             &n_samples, full_utt)) < 0)
                    return nfr;
        
                /* Score and search as much data as possible */
                if (no_search)
                    continue;
                if ((nfr = ps_search_forward(ps)) < 0)
                    return nfr;
                n_searchfr += nfr;
            }
        
            // added to get feature
            for (i = 0; i < n_searchfr; i++)
                for (j = 0; j < 13; j++)
                    E_INFO("%d %d: %f\n", i, j, ps->acmod->mfc_buf[i][j]);
        
            return n_searchfr;
        }
        
         

        Last edit: qiqi 2016-05-12
        • Nickolay V. Shmyrev

          You should not start dump from 0, mfc_buf is a circular buffer, it must start from acmod->mfc_outidx

           

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.