Hi @Martin_08,
What are the warnings for lines 7, 30, and 38? Those often give you an indication of what might be wrong.
Can you paste in a static set of raw features from the test set in the project to see if that gives you what you expect? For example, from Live classification - Tutorial: Continuous motion recognition - Edge Impulse, we can copy the raw features from the first window.
Try setting the following (we comment out the raw data collection and set the static features copied from the test sample in the project):
...
while (1) {
// fill the features array
static float raw_features = {0.7500, 1.7100, 19.9800, 0.8800, 2.1500, 18.9100, 0.8800, 2.1500, 18.9100, 1.4400, 2.2000, 16.7000, 1.9700, 2.2900, 13.7400, 2.2600, 1.8500, 12.0300, 2.4500, 1.2800, 11.4000, 2.1700, 1.2800, 8.7300, 2.5200, 0.9300, 5.6300, 2.5200, 0.9300, 5.6300, 1.3500, 0.4500, 4.9000, 0.2000, 0.3900, 5.7600, -0.6000, 0.1600, 6.4200, 0.3900, -0.0700, 4.7000, 0.6800, -0.2900, 6.0000, 0.3000, 0.2100, 4.7400, 0.3000, 0.2100, 4.7400, 0.6600, 0.5700, 3.5600, -0.0200, 0.2700, 4.0700, -0.6400, 0.2400, 3.4600, -0.8300, 0.0100, 2.1900, 0.0500, -0.3600, 0.0900, 1.1300, -0.7300, -2.2000, 0.8500, -0.9600, -2.4900, 0.8500, -0.9600, -2.4900, 0.2300, -1.7300, -1.5900, 0.2500, -1.8700, -0.8700, 0.3500, -1.7800, -0.8700, 1.0300, -1.0600, -0.5800, 2.4700, -0.1200, -0.3300, 3.2300, -0.0800, 2.4700, 3.2300, -0.0800, 2.4700, 2.5400, -0.0600, 6.9100, 1.9300, 0.3800, 8.2800, 2.8400, 1.5000, 9.1200, 3.1900, 1.7700, 12.0100, 2.7400, 1.6600, 13.3700, 3.0500, 2.1600, 13.6300, 3.0500, 2.1600, 13.6300, 2.8500, 2.0600, 15.2600, 2.0500, 1.6500, 17.6100, 1.3400, 1.5600, 18.5900, 1.7600, 2.0800, 15.8500, 2.8400, 2.6600, 13.1900, 2.6400, 2.4900, 14.8600, 1.7500, 1.8400, 18.4100, 1.7500, 1.8400, 18.4100, 1.8600, 1.9200, 19.0600, 2.4300, 2.4300, 18.2200, 2.2900, 2.5200, 18.0800, 1.3800, 2.2500, 18.9200, 0.9400, 2.3100, 19.8100, 0.8800, 2.4800, 19.5500, 0.8800, 2.4800, 19.5500, 1.1700, 2.6800, 18.7600, 1.6200, 2.8100, 17.9200, 1.9700, 2.7800, 16.8300, 1.7800, 2.6100, 16.2500, 1.2700, 2.7900, 15.7900, 0.3800, 2.6300, 16.1800, 0.3800, 2.6300, 16.1800, 0.4400, 2.3400, 16.1900, 1.6500, 2.4200, 14.7400, 2.4800, 2.6500, 11.8700, 2.7500, 2.5900, 7.5900, 2.8600, 1.8700, 5.3600, 2.2800, 1.0300, 5.3000, 1.0200, 0.4700, 5.4200, 1.0200, 0.4700, 5.4200, 0.0000, 0.0000, 6.6700, 0.6600, -0.1900, 5.7500, 1.0500, 0.0500, 3.4900, 0.6900, -0.1100, 2.1700, 0.1900, -0.5600, 1.5500, 0.5600, -1.3800, 3.5900, 0.5600, -1.3800, 3.5900, 0.0000, -1.5600, 3.1900, -0.5700, -1.1000, 0.6100, -0.4400, -1.0800, -0.8800, -0.1500, -1.3300, -0.4000, 0.2000, -1.6000, 1.5100, -0.1400, -1.7100, 3.0900, -0.4600, -1.5600, 3.6200, -0.4600, -1.5600, 3.6200, 0.6300, -1.2000, 3.1600, 1.1000, -0.7700, 3.2500, 0.4000, -0.6100, 5.3000, 0.7900, -0.5700, 7.3400, 1.0100, -0.5800, 8.1900, 1.1300, -0.3500, 8.2400, 1.1300, -0.3500, 8.2400, 1.3500, -0.1200, 8.4800, 1.8700, 0.2500, 8.4500, 2.2600, 0.3000, 10.3600, 2.7700, 0.3100, 12.3000, 2.7400, 0.8300, 12.7300, 3.2100, 1.2100, 12.2500, 3.2100, 1.2100, 12.2500, 3.2300, 1.3500, 12.6900, 3.3700, 1.7100, 13.7400, 4.1800, 1.7900, 15.7700, 5.0400, 2.0300, 14.9700, 5.6900, 2.3500, 13.6000, 5.1000, 2.3200, 14.5000, 4.0100, 2.3800, 16.6700, 4.0100, 2.3800, 16.6700, 2.5700, 2.2100, 18.2400, 1.9600, 2.2300, 18.2900, 1.9000, 2.1600, 18.4900, 1.9900, 1.8500, 18.6100, 1.2300, 1.7900, 18.2000, 0.4000, 2.0600, 16.9600, 0.4000, 2.0600, 16.9600, 0.2700, 2.1800, 15.8300, 0.4200, 2.2800, 15.3100, 0.7600, 2.2000, 15.1400, 0.7000, 2.0000, 16.0300, 0.6500, 1.9600, 16.1400, 0.6400, 2.2500, 13.7000, 0.6400, 2.2500, 13.7000, 0.8300, 2.2100, 11.2000, 0.9000, 1.7400, 10.4600, 0.8400, 1.3700, 10.0600, 0.5600, 0.9700, 9.6300, -0.3700, 0.7700, 8.8500};
memcpy(features, raw_features, sizeof(features));
/*
for (size_t ix = 0; ix < EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE; ix += EI_CLASSIFIER_RAW_SAMPLES_PER_FRAME) {
int64_t next_tick = t.read_us() + time_between_samples_us;
BSP_ACCELERO_AccGetXYZ(pDataXYZ);
// copy accelerometer data into the features array
features[ix + 0] = (float)pDataXYZ[0];
features[ix + 1] = (float)pDataXYZ[0];
features[ix + 2] = (float)pDataXYZ[0];
while (t.read_us() < next_tick) {
/* busy loop */
}
}
*/
// frame full? then classify
ei_impulse_result_t result = { 0 };
...
This should give you nearly the same output found in the Studio:
- Idle: 0.00
- Snake: 0.00
- Updown: 1.00
- Wave: 0.00
- Anomaly: -0.54