Edge Impulse API Version selection

Hello,

I have been experiencing issues with the Edge Impulse wrapper for Nordic and the Edge Impulse API. I am using the nRF52840 Development Kit (nRF Connect SDK 2.4.2) and have modified the wrapper to fit my use case, while leaving the core functionality intact, including the use of threading. However, since the last update on August 15th, there seems to be a problem with the callback functionality. The prediction runs only once and does not proceed to the next frame. Since the older models, which I converted before the updates, still work correctly, I assume that the issue is not caused by my code.

I found a makeshift workaround by extracting the TensorFlow Lite model from the newly converted ZIP file and embedding it into the functioning Edge Impulse SDK. This process is cumbersome because each new model receives its own unique name/number, requiring manual file edits. Additionally, I am unsure if any other parameters are being overlooked that could affect performance.

This is the fundamental problem I am facing. The main issue is that I am unable to determine how, or if it is even possible, to revert the API version to v1.56.9 or v1.55.1. I convert my models using the Python SDK and cannot find any information on selecting the API version. Since I am effectively uploading my model and having it converted externally, it seems that changes could be made to my workflow without my knowledge or have the ability to prevent it and stay on a “stable” version.

Is there any way to resolve this issue? Thank you in advance.

Hi @aniak

Thank you for reporting however the Nordic wrapper to the best of my knowledge is not supported by us, @vojislav @mateusz can you confirm? It would be best to log on the Nordic forum.

Regarding extracting the TensorFlow Lite model from the newly converted ZIP file and embedding it into the functioning Edge Impulse SDK, this for sure is not recommended or supported, you will be missing operations and functionality. @AIWintermuteAI fyi

It would be best to follow the recommendations on our supported device pages, or C/Zephyr:

Best

Eoin

Hi @jorduino,

thank you for your reply.

So is there no way to select the API version for the Conversion-Tool via the Python SDK?

Best
Nicolas

Hi @aniak

It sounds like your level of custom support would need time with one of our solutions engineers. Are you working with sales or solutions for this? Our solutions engineers will be able to work with you for that level of API / SDK support. I can connect you if you dont already have a contact.

cc: @jbuckEI @jimbruges @Arjan

Best

Eoin

For anyone else facing this issue, we have identified the issue and a fix. We are investigating this change to BYOM to see if this is an isolated issue with this particular model type or something else.
This was an issue with the models not actually receiving 328 input samples. When I compared the model_metadata.h files I noted that “EI_CLASSIFIER_RAW_SAMPLE_COUNT” and “EI_RAW_SAMPLES_PER_FRAME” swapped between the old and new models.

EI_CLASSIFIER_RAW_SAMPLE_COUNT was being referenced in your edge_impulse_handler.c file as *ei_get_wrapper_frame_size():

in the old models it was set to 328 samples, in the new one it was getting “1”.

From my investigation into the source behind this function in lib/edge_impulse inside the Nordic Edge Impulse Wrapper for nrfConnect SDK 2.4.2

/ei_wrapper.cpp it is looking for: #INPUT_FRAME_SIZE:

#define INPUT_FRAME_SIZE EI_CLASSIFIER_RAW_SAMPLES_PER_FRAME

As a workaround you can either:

  • Manually change line 15 in external/nrf/lib/edge_impulse/ei_wrapper.cpp in your SDK to #define INPUT_FRAME_SIZE EI_CLASSIFIER_RAW_SAMPLE_COUNT
  • Unzip your model and swap the two values back around in your new model_metadata.h file (EI_CLASSIFIER_RAW_SAMPLES_PER_FRAME & EI_CLASSIFIER_RAW_SAMPLE_COUNT)
1 Like