Arduino Library Classification result throws error after index 28

I’m new to Edge Impulse and this is my first project. If you need more information, just let me know.

ProjectID: 367723
Question/Issue:
I am working on a XIAO ESP32 S3 and trying to create an image detection. I exported the Arduino Library and imported it into my IDE. With help of the ESP32 Camera Example the Library offered I implemented the required code into my project. It works fine, the classifier runs, but when I want to print out the results, it only goes up to index 28 and then an error is thrown:

    ...
    Q: 0.30078
    R: 0.00000
    S: 0.00000
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x400556b4  PS      : 0x00060a30  A0      : 0x8202f55c  A1      : 0x3fceb5c0  
A2      : 0x0000cbc5  A3      : 0x0000cbc1  A4      : 0x000000ff  A5      : 0x0000ff00  
A6      : 0x00ff0000  A7      : 0xff000000  A8      : 0x002e2e2e  A9      : 0x00000020  
A10     : 0x00060023  A11     : 0x00000001  A12     : 0x00000001  A13     : 0x00000004  
A14     : 0x00060d23  A15     : 0x00000017  SAR     : 0x00000020  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x0000cbc5  LBEG    : 0x400556d5  LEND    : 0x400556e5  LCOUNT  : 0xffffffff  


Backtrace: 0x400556b1:0x3fceb5c0 |<-CORRUPTED

Here is the Code - the error is thrown when the for-loop index reaches 29.

    ei::signal_t signal;
    signal.total_length = 32 * 32;
    signal.get_data = &ei_camera_get_data;

    // Run the classifier
    ei_impulse_result_t result = { 0 };
    EI_IMPULSE_ERROR eierr = run_classifier(&signal, &result, false);
    Serial.print(eierr);
    if (eierr != EI_IMPULSE_OK) {
      Serial.printf("ERR: Failed to run classifier (%d)\n", eierr);
      return;
    }
    // print the predictions
    ei_printf("Predictions (DSP: %d ms., Classification: %d ms., Anomaly: %d ms.): \n", result.timing.dsp, result.timing.classification, result.timing.anomaly);
    for (size_t ix = 0; ix < EI_CLASSIFIER_LABEL_COUNT; ix++) {
      ei_printf("    %s: %.5f\n", result.classification[ix].label,
                result.classification[ix].value);
    }
    free(&result);

The library had predefined values which i increased to 36 to try if it solves the problem (I need all 26 Letters and 10 numbers → 36)

#define EI_CLASSIFIER_MAX_OBJECT_DETECTION_COUNT 36
#define EI_CLASSIFIER_MAX_LABELS_COUNT 36

I think I messed up something with reserving but I cannot solve it myself :frowning:

If you need more Information just let me know.

Thanks for any help!

When I run the Classifier with debug mode, I get this output, which reaches to the last char:

Features (0 ms.): 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.882353 0.000000 0.000000 0.000000 0.000000 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.000000 0.000000 0.000000 0.000000 0.000000 0.996078 0.996078 0.996078 0.996078 0.996078 0.882353 0.000000 0.000000 0.000000 0.000000 0.000000 0.996078 0.996078 0.996078 0.996078 0.996078 0.882353 0.000000 0.000000 0.000000 0.000000 0.113725 0.996078 0.996078 0.996078 0.996078 0.996078 0.882353 0.000000 0.996078 0.996078 0.000000 0.113725 0.996078 0.996078 0.996078 0.996078 0.996078 0.298039 0.113725 0.996078 0.996078 0.000000 0.698039 0.996078 0.996078 0.996078 0.996078 0.996078 0.000000 0.698039 0.996078 0.298039 0.000000 0.996078 0.996078 0.996078 0.996078 0.996078 0.882353 0.000000 0.698039 0.000000 0.000000 0.698039 0.996078 0.996078 0.996078 0.996078 0.996078 0.298039 0.000000 0.000000 0.000000 0.000000 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.000000 0.000000 0.000000 0.000000 0.113725 0.996078 0.996078 0.996078 0.996078 0.996078 0.882353 0.000000 0.000000 0.000000 0.000000 0.113725 0.996078 0.996078 0.996078 0.996078 0.996078 0.298039 0.000000 0.882353 0.000000 0.000000 0.113725 0.996078 0.996078 0.996078 0.996078 0.996078 0.000000 0.698039 0.996078 0.882353 0.000000 0.698039 0.996078 0.996078 0.996078 0.996078 0.882353 0.000000 0.996078 0.996078 0.882353 0.000000 0.996078 0.996078 0.996078 0.996078 0.996078 0.298039 0.113725 0.996078 0.996078 0.000000 0.113725 0.996078 0.996078 0.996078 0.996078 0.298039 0.000000 0.000000 0.000000 0.000000 0.000000 0.698039 0.996078 0.996078 0.996078 0.996078 0.000000 0.000000 0.000000 0.000000 0.000000 0.113725 0.996078 0.996078 0.996078 0.996078 0.882353 0.000000 0.000000 0.000000 0.000000 0.000000 0.996078 0.996078 0.996078 0.996078 0.996078 0.298039 0.000000 0.000000 0.000000 0.000000 0.698039 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.996078 0.611765 0.694118 0.003922 0.478431 0.223529 0.384314 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.796079 0.078431 0.000000 0.000000 0.000000 0.000000 0.027451 0.058824 0.164706 0.074510 0.054902 0.105882 0.000000 0.000000 0.000000 0.000000 0.749020 0.474510 0.211765 0.000000 0.254902 0.078431 0.058824 0.054902 0.152941 0.662745 0.443137 0.278431 0.164706 0.274510 0.164706 0.274510 0.164706 0.274510 0.164706 0.274510 0.164706 0.274510 0.137255 0.039216 0.109804 0.031373 0.180392 0.094118 0.003922 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 
Predictions (time: 52 ms.):
0:	0.000000
1:	0.000000
2:	0.000000
3:	0.000000
4:	0.000000
5:	0.000000
6:	0.000000
7:	0.000000
8:	0.000000
9:	0.000000
A:	0.000000
B:	0.000000
C:	0.000000
D:	0.000000
E:	0.000000
F:	0.000000
G:	0.000000
H:	0.000000
I:	0.000000
J:	0.000000
K:	0.000000
L:	0.000000
M:	0.000000
N:	0.000000
O:	0.000000
P:	0.000000
Q:	0.996094
R:	0.000000
S:	0.000000
T:	0.000000
U:	0.000000
V:	0.000000
W:	0.000000
X:	0.000000
Y:	0.000000
Z:	0.000000
00
Predictions (DSP: 1065287680 ms., Classification: 1007671732 ms., Anomaly: 0 ms.): 
    0: 0.00000
    1: 0.00000
    2: 0.00000
    3: 0.00000
    4: 0.00000
    5: 0.00000
    6: 0.00000
    7: 0.00000
    8: 0.00000
    9: 0.00000
    A: 0.00000
    B: 0.00000
    C: 0.00000
    D: 0.00000
    E: 0.00000
    F: 0.00000
    G: 0.00000
    H: 0.00000
    I: 0.00000
    J: 0.00000
    K: 0.00000
    L: 0.00000
    M: 0.00000
    N: 0.00000
    O: 0.00000
    P: 0.00000
    Q: 0.99609
    R: 0.00000
    S: 0.00000
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x400556b4  PS      : 0x00060a30  A0      : 0x8202f79c  A1      : 0x3fceb5b0  
A2      : 0x0001492d  A3      : 0x00014929  A4      : 0x000000ff  A5      : 0x0000ff00  
A6      : 0x00ff0000  A7      : 0xff000000  A8      : 0x002e2e2e  A9      : 0x3fceb5c0  
A10     : 0x3fceb61c  A11     : 0x00000004  A12     : 0x0000000f  A13     : 0x00000080  
A14     : 0x00000000  A15     : 0x0000000f  SAR     : 0x00000020  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x0001492d  LBEG    : 0x400556d5  LEND    : 0x400556e5  LCOUNT  : 0xffffffff  


Backtrace: 0x400556b1:0x3fceb5b0 |<-CORRUPTED

Hey, I figured it out while rubber-duck-debugging with my friend:

To override the EI_CLASSIFIER_MAX_LABELS_COUNT I had to define it before including the edgeimpulse lib.

It seems to have a default value of 25 and I’m wondering weather it is a bug, because I have 36 labels.

1 Like

Hi @Tizi

Not quite a bug. Its set by our embedded team to give more accurate estimations on ram consumption.

A soft limit on the value based on our test cases. @AIWintermuteAI had thoughts on this and may offer a comment if this will remain or be logged as an issue/feature request :sweat_smile:

Best

Eoin