Raw features data format (float)

Question

I’m new to Edge Impulse so excuse my confusion if these seems blindingly obvious to others!

Hi, I’ve managed to build an impulse, uint8 model inorder to fit it into memory for an STM32F4 Discovery board. My question relates to the ‘features’ array data type that is used.

Eg.

// paste the raw features here
static const float features[] = {
-145, 5, 66, -55, 30, -111, -112, -246,…
};

In the examples, there is a direction to copy these raw features from the ‘Live Classification’ area, inorder to test the inference.

When this copy takes place, and the data is placed into the ‘features’ array (as) above, regardless of them looking like signed int values, they will take on the float data type. Sizeof(float) returns 4 bytes. Indeed, the float is a 32 bit data type on the STM32F4x.

Given the range of values that are being copied from the Raw Features, in my case i’m reading int16_t audio samples, is this not wasteful of memory to declare the features buffer as a float or am I missing an important step here?

After reading my audio samples (as int16_t) I can use INT16_TO_FLOAT or CAST them to float placing the result into the features buffer, but this again would double the memory usage. Is this the correct thing to do?

Am I missing something or can I pass the audio buffer chunk directly to the impulse without conversion?

Can you also clarify please: With regards to the naming of the ‘features’ array which is passed for classification. I always perceived the ‘features’ as those after post processing, I think these are the MFCCs (in my model at least) which are used in the model training (and inference). ‘Raw features’, these are the raw audio samples that are copied (as above from the ‘Live Classification’ area, so shouldn’t the features array be called ‘rawFeatures’ in this case?

All of the online examples state ‘features’, despite the comments sometimes saying ‘raw features’. …these things may seem obvious, but when you get unexpected results …it casts doubt.

2 Likes

Further to this …If I’m copying the data from the ‘Raw Features’ window in Live claasification, would these features not be int16_t given that they’re PCM samples? Copying them directly into the float buffer without converting them to float would cause an issue, would it not?

1 Like

Is anyone available from EI please? I’ve tried retraining, recompiling, copying various ‘raw features’ into the buffer from the Live Classification area. My code compiles, runs and is able to give me a confidence level etc. But, the classification is stuck on ‘noise’ regardless of which ‘raw features’ I copy in from the Live Classification area. It works when I run in the browser so the impulse is OK I guess. Project is 620261. :confused: