Stale version of run_classifier_continuous function in EI Studio Deploy source export?

Hi,

I successfully started from the “continuous-audio-sampling” tutorial to create, train, deploy and test on an Arduino Nano 33 BLE Sense board, but have run into trouble trying to extend to control the enable_maf argument to “run_classifier_continuous” function.

If I am doing and interpreting correctly, the source code built & exported from Studio Deployment looks to include an old version of the run_classifier_continuous function in ei_run_classifier.h. This does not include the enable_maf argument, which has been added in later versions of the EI SDK, including present in the current github master version.

I am puzzled and suspicious though since I think that function was updated in commit on 12-April-2021, so can the EI Studio integration and source export of SDK really be missing that or have I done or interpreted something wrong?

I have repeated the steps 3 times now with fresh projects, and each time the exported source code seems to have the stale version of the above function.

Specifically in the exported code I am looking at the following function:
<myHomePath>/Downloads/<myProjectName>/src/edge-impulse-sdk/classifier/ei_run_classifier.h

extern "C" EI_IMPULSE_ERROR run_classifier_continuous(signal_t *signal, ei_impulse_result_t *result,
                                                      bool debug = false)

Where I had expected to see the newer arguments as here:

extern "C" EI_IMPULSE_ERROR run_classifier_continuous(signal_t *signal, ei_impulse_result_t *result,
                                                      bool debug = false, bool enable_maf = true)

from github master: inferencing-sdk-cpp/ei_run_classifier.h at master · edgeimpulse/inferencing-sdk-cpp · GitHub

Please can you help confirm if there is an issue here, or if I have done something wrong or mis-interpreted?

Outline of minimum steps in studio.edgeimpulse.com:

  1. Create project
  2. Import data
  3. Create impulse design: MFCC + NN Classifier 1D Conv; generate features & train model
  4. Deployment: Arduino Library; build
  5. Inspect the exported source code for /src/edge-impulse-sdk/classifier/ei_run_classifier.h

(I tried to include more links to be helpful but not allowed as a newcomer here)

Hi @colosb,

Thanks for your report. We’re currently working on a new method to control averaging. That’s why the current sdk doesn’t include enable_maf. This means averaging is always enabled and averages the number of time slices that fit in the complete model. For now I’ll return the enable_maf parameter. To disable averaging quickly, you can comment out this part:

#if (EI_CLASSIFIER_SENSOR == EI_CLASSIFIER_SENSOR_MICROPHONE)
        if((void *)avg_scores  != NULL) {
            result->label_detected = avg_scores->trigger(result->classification);
        }
#endif
1 Like

Thanks for your reply @Arjan , that works. I chose to put in control via enable_maf to allow the options to be configured and tested from overall app. I tested, it works, and setting enable_maf to false is much better for my use-case.

It will be good to have a longer-term solution through EI in due course.

extern "C" EI_IMPULSE_ERROR run_classifier_continuous(signal_t *signal, ei_impulse_result_t *result,
                           bool debug = false, bool enable_maf = true)
#if (EI_CLASSIFIER_SENSOR == EI_CLASSIFIER_SENSOR_MICROPHONE)
    if((enable_maf) && (void *)avg_scores != NULL) {
      result->label_detected = avg_scores->trigger(result->classification);
    }
#endif
1 Like

Great that you got it working.

And thanks for the feedback, is much appreciated!