I m using stm32wb55 dev board with lsm6dsl accelerometer, I have recorded 3 simple patterns with 100 Hz sampling freq and created a build for cubemx and implemented it in my project.
Now I need to implement the function get_feature_data(size_t offset, size_t length, float *out_ptr) to run on my board and to recognize the pattern but here I’m confused. I m using a fifo buffer and storing my acceleration data in it and taking a sample every 10 ms.
Should I just forward the complete buffer?
How often should I call this function to recognize my patterns which are simple shaking,idle,moving up-down?
You need to fill the features array with accelerometers values of a single window. The easiest way is to loop over EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE, see for instance the getSensors() function here which uses a 3-axis sensor too: https://github.com/edgeimpulse/example-sparkfun-ccs811-himax/blob/099f11594c99ee784ce29e66f1a787c4b4d74e9d/classification/main.cc#L82
You can also find more information in our documentation to store your features’ array in Flash or RAM.
I have implemented it without the buffer just reading like in the example as you said.
It can detect shaking, up and down, But the Idle state is always wrong, the board is calm on the ground not moving at all. This is the result for idle state
The accuracy of the modle was about 98% for all 3 states.
What could be the problem?
I have ported the c++ library using a Makefile maybe I did something wrong? But there is no warnings when compiling so I assume it is good.
That’s interesting. Could you select raw features of one idle sample in the Studio (you can do that from the Live Classification and select a sample from your Test Set) and juste paste it in the features array in your code? It’s just a static test to check if issue is from data acquisition or from the model itself.
Also, could you share the code snippet you used to collect data on your board?
I have changed from Spectral Analysis to Raw data the processing block and it works very good even on my board.