Importing data to edge impulse

Ya Actually i was experimenting multiple things and then i was able to either not able to upload or achieve accuracy .

Now it has solved my problem . But thanks so much for the support.

1 Like

@louis While deploying the model on Arduino IDE . In examples by default i am finding only
1.nano_ble33_sense_accelerometer
2.nano_ble33_sense_accelerometer_continous
3.nano_ble33_sense_camera
4.nano_ble33_sense_fusion
5.nano_ble33_sesnse_microphone
6.nano_ble33_sense_microphone_continous

Which is right one to use to draw inference .

Hello @Rishab96,

If you collect data from a custom sensor, I would use the static_buffer example, and modify the code to pass the data you collected into a buffer.

I would do something like that for your loop function (example with a custom accelerometer, thus 3 axis and three reading, in your case you probably only read one value):

void loop()
{
    ei_printf("\n ---------------- \n Starting inferencing...\n");

    delay(10);

    ei_printf("Allocating buffer size...");

    // Allocate a buffer here for the values we'll read from the IMU
    float buffer[EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE] = { 0 };

    ei_printf("Done\n");

    ei_printf("Sampling...");

    static unsigned long acquisition_start = millis();
    
    for (size_t ix = 0; ix < EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE; ix += 3) {
        // Determine the next tick (and then sleep later)
        uint64_t next_tick = micros() + (EI_CLASSIFIER_INTERVAL_MS * 1000);

        // read to the end of the buffer
        buffer[ix + 0] = accel.getX();
        buffer[ix + 1] = accel.getY();
        buffer[ix + 2] = accel.getZ();

        delayMicroseconds(next_tick - micros());
    }

    static unsigned long acquisition_end = millis();
    static unsigned long acquisition_time = acquisition_end - acquisition_start;

    ei_printf("Done in %d ms\n", acquisition_time);

    // Turn the raw buffer in a signal which we can the classify
    signal_t signal;
    int err = numpy::signal_from_buffer(buffer, EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE, &signal);
    if (err != 0) {
        ei_printf("Failed to create signal from buffer (%d)\n", err);
        return;
    }
    ei_printf("Done...\n");

    ei_printf("Running the classifier... \n");
    ei_impulse_result_t result = { 0 };

    err = run_classifier(&signal, &result, debug_nn);
    if (err != EI_IMPULSE_OK) {
        ei_printf("ERR: Failed to run classifier (%d)\n", err);
        return;
    }

    // print the predictions
    ei_printf("Predictions ");
    ei_printf("(DSP: %d ms., Classification: %d ms., Anomaly: %d ms.)",
        result.timing.dsp, result.timing.classification, result.timing.anomaly);
    ei_printf(": \n");
    for (size_t ix = 0; ix < EI_CLASSIFIER_LABEL_COUNT; ix++) {
        ei_printf("    %s: %.5f\n", result.classification[ix].label, result.classification[ix].value);
    }
#if EI_CLASSIFIER_HAS_ANOMALY == 1
    ei_printf("    anomaly score: %.3f\n", result.anomaly);
#endif
}

Best,

Louis

@louis But i have not used any sensor for data collection instead i have trained a model using csv upload.

@louis What needs to be done in that case??

@louis Project ID is 139393 . Could please check for this case??

Hello @Rishab96,

I am not sure what you are trying to classify.
You can still use the static_buffer and copy-paste raw data obtained from the studio.

Please see: Arduino library - Edge Impulse Documentation

Best,

Louis

@louis Actually this is demo project that i am trying to do to show it to my manager . He wants me to implement this.I know this is simlpe problem to classify .But thanks for the support.

1 Like