Ai model C++ example problems

Question/Issue:
I am trying to run the ai model in an Ocre micro-container that does motion recognition from Run C++ library on custom boards - Edge Impulse Documentation but when I flash it on my microcontroller, the model keeps predicting only updown class, or rarely wave. Never recognizes idle.

Context/Use case:
The model is using data sampled from a 3-axis accelerometer at 104 Hz. I saw that data was sampled with 62.5 Hz, so I changed it to 104 and re-trained everything on the platform, but nothing changed.
Do I need to create a different training set at 104 Hz?

I tried seeing if there are big differences between my idle data and the idle data from the edge impulse example:

edge impulse: 0.0700, 0.0000, 10.1300, 0.0900, -0.0100, 10.1100, 0.0600, -0.0300, 10.0900, …
mine: 0.032314, -0.436839, 10.061667, 0.053857, -0.428462, 10.040722, 0.041889, -0.440430, 10.028155, …

although x and y are little higher, the model should be able to predict small variance in data since it is simple static data

Environment:

  • Platform: STM32 b_u585i_iot2a
  • Build Environment Details: flashed on an Ocre container

My suggestion would be to first copy a window of “Raw” features for a sample from the Live Classification page in your project. Try running your on-device model using this list of features, if the results match what you’re seeing in Studio on the Live Classification page then it’s likely that the data you’re sending to your model doesn’t match the format that the model expects to see.

For example it should be ordered as: x1,y1,z1,x2,y2,z2,…

If the format is all correct, then it is possible your accelerometer has a different calibration or sensitivity than the one used in your project. It is always best to record data and train your model with the same sensor you’ll use on device. Your assumption of:

although x and y are little higher, the model should be able to predict small variance in data since it is simple static data

is unfortunately not true. The variation between your data and the Edge Impulse data is relatively large so it’s not surprising the model is struggling. Models only know what they have been trained on, so adding some more of your real world data to the model will improve things.