Deployment of impulse on device not showing the expected results

I have followed the tutorials for recognizing sounds from audio!
I have train my own model to recognize a sound, tested it and now trying to run the model on the device directly. When I run the edge-impulse-run-impulse (latest step on tutorial) I was expecting to get predictions but instead I am getting this
image

How can I get the predictions running on the device? Any ideas if I did something wrong?

@Fytos which device is this on?

Thank you for replying! It’s on an Arduino nano 33 BLE sense.

Hi @Fytos, the device is running out of memory (the way the serial is routed on the Arduino Nano 33 BLE Sense does not let you properly see this unfortunately, but you see the LED blink in an SOS pattern). I’d lower the FFT Length in the MFCC tab, e.g. to 256.

1 Like

Hi @janjongboom you were absolutely right that made, thank you.

I am now trying to run my impulse continuously, I started following the tutorial for continuous audio sampling and when I run “edge-impulse-run-impulse --continuous”, I get this:

Any ideas on this??

@Fytos is this your MyVoice project or a different one? I’ve exported to the Nano 33 BLE Sense on that board and that runs for me in continuous mode:

@janjongboom I built a new model and exported it again and now it runs for me as well.

Cheers

@janjongboom Thank you for all your help,

I am also trying to get a digital output on the arduino sense when the prediction is beyond a certain threshold at continuous mode.

I was trying to use the arduino library/example and change it to continuous mode but I am not sure how (I saw that there is a run_classifier_continuous in your sdk but it doesn’t work in the arduino ide), is it supported? Is there any other way?

The continuous sampling is harder to do in a generic way, as it requires a thread and signaling. Easiest is to use https://github.com/edgeimpulse/firmware-arduino-nano-33-ble-sense as a basis, replace the src/model-parameters and src/tflite-model folders here with the folders you get from the C++ export.

Then you get the conclusion from the model here: https://github.com/edgeimpulse/firmware-arduino-nano-33-ble-sense/blob/5df7a56fe825747e1c716172f6ebd691f9c52efb/src/ingestion-sdk-c/ei_run_impulse.cpp#L261 where you can add some own logic.

Hi @janjongboom, unfortunately, I wasn’t able to do the procedure successfully. I downloaded this https://github.com/edgeimpulse/firmware-arduino-nano-33-ble-sense, replaced the two folders with those from C++ export. I then tried to run “firmware-arduino-nano-33-ble-sense” through Arduino IDE but I get this error:
Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: “Arduino Nano 33 BLE”

firmware-arduino-nano-33-ble-sense:25:10: fatal error: src/setup.h: No such file or directory

#include “src/setup.h”

      ^~~~~~~~~~~~~

compilation terminated.

exit status 1

src/setup.h: No such file or directory

Finally, I didn’t understand what you mean by this:

How do I use this (which is C++ code) into my arduino firmware file, which I use as a basis?

Do I get something wrong? Sorry, I haven’t worked with arduinos before, but I’d really like to make this project work.

Thank you again!

I then tried to run “firmware-arduino-nano-33-ble-sense” through Arduino IDE but I get this error:

You can’t build this through the Arduino IDE unfortunately, you’ll need to build with Arduino CLI (see the README for instructions).

How do I use this (which is C++ code) into my arduino firmware file, which I use as a basis?

You can take your Arduino firmware file, and incorporate it in that C++ file. Unfortunately we lose a bit of integration with the Arduino ecosystem and IDE when going this route. If you have some example code we can help you integrate it.

Hi again,
I would like to use this board as a command-word recognition device. I want to have the output as input to other devices or just to be able to use it somehow e.g. send it over wifi (not sure how yet). Also I would like to use the data from the other sensors of the board.

That’s the reason why I would like to be able to play with the source file. Is it any easier to do this using the other board (ST B-L475E-IOT01A) instead of Arduino nano 33?

Thank you @janjongboom

Hi @Fytos,

I’d take the following steps:

  1. Make sure you can build the firmware-arduino-nano-33-ble-sense project - as a sanity check.
  2. Remove the model-parameters and tflite-model folders from this project, and replace them with the folders from the C++ Library export.
  3. Build the project again, and make sure you see good output when you run edge-impulse-run-impulse --continuous
  4. You can then add some extra code (f.e. a print statement) here that runs when your keyword is being heard: https://github.com/edgeimpulse/firmware-arduino-nano-33-ble-sense/blob/5df7a56fe825747e1c716172f6ebd691f9c52efb/src/ingestion-sdk-c/ei_run_impulse.cpp#L261
    • Compare the label with the label that you’re looking for and value should be above a certain threshold.
  5. If that works you can integrate any other Arduino libraries to respond to the keyword. The example project can contain Arduino libraries like any other Arduino application.

Hope this helps a bit!

2 Likes

Thank you for your latest reply. It makes much more sense to me now.

It seems that I have a problem with step 1. I can’t run the arduino-build.sh file. Does it require any special program to open this?

Hey, didn’t realize we only have a build script for macOS and Linux. Try this:

arduino-cli compile --fqbn arduino:mbed:nano33ble --build-properties build.extra_flags="-I ./src -I./src/model-parameters -I ./src/repl -I ./src/ingestion-sdk-c/ -I ./src/ingestion-sdk-c/inc -I ./src/ingestion-sdk-c/inc/signing -I ./src/ingestion-sdk-platform/nano-ble33 -I ./src/sensors -I ./src/QCBOR/inc -I ./src/QCBOR/src -I ./src/mbedtls_hmac_sha256_sw/ -DARDUINOSTL_M_H -DMBED_HEAP_STATS_ENABLED=1 -DMBED_STACK_STATS_ENABLED=1 -O3 -g3 -DEI_SENSOR_AQ_STREAM=FILE -DEIDSP_QUANTIZE_FILTERBANK=0 -DEI_CLASSIFIER_SLICES_PER_MODEL_WINDOW=3 -mfpu=fpv4-sp-d16" --output-dir .

Then find your board port (COM3 or something) via:

arduino-cli board list

And run:

arduino-cli upload -p COM3 --fqbn arduino:mbed:nano33ble --input-dir .
1 Like

Hi,

I feel bad asking for everything, but what about this error?

@Fytos No need to feel bad! I’ll fire up a VM later today and will check.

1 Like

Hi @Fytos,

Just tried it on Windows and it seems to work fine.

Can you run those commands to install core and library if not done already?

$ arduino-cli core update-index
$ arduino-cli core install arduino:mbed@1.1.4
$ arduino-cli lib update-index
$ arduino-cli lib install Arduino_LSM9DS1@1.0.0

Then you will need to install the platform.local.txt file as mentioned in this article.

Let us know if compiling works afterwards.

Aurelien

1 Like

Hello guys,

I upgraded to mbed 1.1.6 and returned back to 1.1.4 and that for some reason cleared that error from yesterday. I can compile and run my impulse in continuous mode. Now I will try to add my own code in ei_run_impulse.cpp

Thank you so much for your support!

1 Like