@Eoin
Okay I did a bit of digging …
What did I do?
- Edit
<lib>/src/model-parameters/model_variables.h
and add the extra uncertain category to it
const char* ei_classifier_inferencing_categories[] = { "ambient", "discomfort", "hungry", "sick", "tired", "uncertain" };
- Edit
<lib>/src/model-parameters/model_metadata.h
and increase the value of EI_CLASSIFIER_LABEL_COUNT
from previously 5 to now 6 as we added the extra category uncertain in const char* ei_classifier_inferencing_categories[]
(model_variables.h).
The numbers of labels incremented for sure, when I use this debug part in my main sketch when I check by the below print statements:
ei_printf("---------------------\n");
ei_printf("Inferencing settings:\n");
ei_printf("\tInterval: %.2f ms.\n", (float)EI_CLASSIFIER_INTERVAL_MS);
ei_printf("\tFrame size: %d\n", EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE);
ei_printf("\tSample length: %d ms.\n", EI_CLASSIFIER_RAW_SAMPLE_COUNT / 16);
ei_printf("\tNo. of classes: %d\n", sizeof(ei_classifier_inferencing_categories) /
sizeof(ei_classifier_inferencing_categories[0]));
ei_printf("\tClassifier label count: %d\n", EI_CLASSIFIER_LABEL_COUNT);
ei_printf("sizeof(ei_classifier_inferencing_categories): %d\n", sizeof(ei_classifier_inferencing_categories));
ei_printf("sizeof(ei_classifier_inferencing_categories[0]): %d\n", sizeof(ei_classifier_inferencing_categories)[0]);
ei_printf("---------------------\n\n");
Resulting serial console output:
---------------------
Inferencing settings:
Interval: 0.06 ms.
Frame size: 32000
Sample length: 2000 ms.
No. of classes: 6
Classifier label count: 6
sizeof(ei_classifier_inferencing_categories): 24
sizeof(ei_classifier_inferencing_categories[0]): 4
---------------------
Please pay attention to
No. of classes:
-
Classifier label count:
(called from model_metadata.h)
But on running classification one of the labels is null
and not uncertain
.
The part, from my main sketch, that prints the classification results:
for (size_t ix = 0; ix < EI_CLASSIFIER_LABEL_COUNT; ix++) {
ei_printf(" %s: %.5f\n", result.classification[ix].label, result.classification[ix].value);
}
And, that results to:
ambient: 0.00000
discomfort: 0.01172
hungry: 0.98438
sick: 0.00000
tired: 0.00391
(null): 0.00000
As you can see, uncertain is not picked up from ei_classifier_inferencing_categories[]
Not sure but I believe that ei_impulse_result_t
needs to be told that uncertain exists but not sure if it is ported at the first place from edge impulse or where to look for it .
Any guidance here or am I shooting in the dark, anyone, @rjames ?
(Thanks in advance)