EI_IMPULSE_DSP_ERROR When Running Classifier

Question/Issue:
Hello there, when running run_classifier of my input data I seem to be getting the error stated in the topic subject all of the time. Every time that I am classifying data, I will get this error at different time periods, sometimes I will receive this error immediately when I begin classifying data other times it is within minutes of classifying data. There is no real good explanation of why this error occurs and it appears in multiple locations so it is hard to pinpoint where I may be running into this error at.

Project ID:
147362

Context/Use case:
Flame detection based strictly off of temperature data.

Hello @matt001k,

Which hardware are you using?

I just had a quick look at your project, nothing seems odd.
I can also run the Standalone example using C++ locally on my laptop.

./build/app
Features (0 ms.): 450.000000 450.000000 450.000000 450.000000 0.000000 0.000000 -3.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -3.000000 72.073334 68.000000 81.000000 72.325150 6.030036 0.804858 -1.352205 
Running impulse...
Predictions (time: 0 ms.):
Flame:	0.006545
NoFlame:	0.993455
run_classifier returned: 0
Timing: DSP 0 ms, inference 0 ms, anomaly 0 ms
Predictions:
  Flame: 0.00654
  NoFlame: 0.99346

Note that I used the float32 version of your model (which was previously selected).

Best,

Louis

Hello @louis,

I am running this on a cortex-M4 MCU (custom product implementation).
The port into my project was basically the standalone project that you linked.
The only difference is I am directly passing a buffer in with:

        numpy::signal_from_buffer(buf,
                                  EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE,
                                  &signal);

Then using signal in run_classifier.

Would this error be apparent if the classifier saw data that might not be expected?

Hello @louis
This is where we are failing at:
image

@louis any update on this?

Hello @matt001k,

Sorry for the late reply.
I cannot find this error on our SDK, can you point in which file is it?

Here is more info on the DSP errors:

Best,

Louis

It looks like the error is coming from this line: inferencing-sdk-cpp/ei_run_classifier.h at 4c9654771bc1a0a3a783d6ea2ad4d2ef63c7af38 · edgeimpulse/inferencing-sdk-cpp · GitHub.

@matt001k - did you modify that error code to be EI_IMPULSE_DSP_ERROR_1?

I’ve gotten into trouble before using the signal_from_buffer() function. My guess is that you’re not passing in the address of your buf array correctly or the signal struct is malformed. All that function does is just set up the paging callback function for you (behind the scenes in the SDK library).

I might recommend constructing the callback function yourself. That usually makes it easier to debug how the actual transfer of data is occurring to the internal inferencing buffer (i.e. with a step-through debugger or even just using ei_printf() to print out your buffer).

Here’s a simple example of how to create that callback function (named get_signal_data() in this case): example-standalone-inferencing/main.cpp at master · edgeimpulse/example-standalone-inferencing · GitHub

1 Like

Hello shawn,

I notices that this is an issue with memory allocation in the system. When the controller got into an actual running state there was quite a lot of other malloc’ing going on (snprintf, etc, etc) which caused our heap_4.c implementation of FreeRTOS heap to run out of space. The return code for this failure is EIDSP_OUT_OF_MEM = -1002.
Having visibility to this error could have saved quite a lot of time (I replaced that return with the value of ret).
Thanks for the help!

1 Like