cancel
Showing results for 
Search instead for 
Did you mean: 

What are the additional scaling factors applied during feature computation on IMU chips with MLC?

GHead.1
Associate

In developing some activity classification models using the LSM6DSOX, I have noticed that some information regarding the computation of features appears absent from the documentation. For some features (mean, min, max, maybe more), it would appear that the raw components (X, Y, and Z) as well as the norm are scaled by a factor of 1/1000; similarly, the norm squared variable seems to get scaled by 1/1,000,000. However, this does not seem to hold for other features like variance or energy.

This is based on analysis of results returned from the Unico API (as accessed from this repo: https://github.com/STMicroelectronics/STMems_Machine_Learning_Core/tree/master/tools/mlc_python_script). Below I have displayed two printouts comparing the Unico result and manual computation of features in Python.

Max value:

Unico results:
   F27_MAX_on_ACC_X  F28_MAX_on_ACC_V  F29_MAX_on_ACC_V2
0          0.003998          0.006924           0.000048
1          0.003998          0.006924           0.000048
 
Manual results:
   A_X [mg]     ACC_V  ACC_V2
0       4.0  6.928203    48.0
1       4.0  6.928203    48.0

Energy:

Unico results:
   F7_ENERGY_on_ACC_X  F8_ENERGY_on_ACC_V  F9_ENERGY_on_ACC_V2
0            0.000273            0.000777                  0.0
1            0.000273            0.000777                  0.0
 
Manual results:
   A_X [mg]  ACC_V   ACC_V2
0     273.0  819.0  31941.0
1     273.0  819.0  31941.0

Could someone please clarify what is happening here? Beyond just the scaling, it would also seem that floating point accuracy is diminished as part of this scaling. I have searched every piece of documentation I can find and no mention of these scaling factors is apparent to me. Please find attached code (with annotated Jupyter notebook) describing my analysis.

1 ACCEPTED SOLUTION

Accepted Solutions
Eleon BORLINI
ST Employee

Hi @GHead.1​ ,

that's correct, there is a 1/1000 multiplier because the accelerometer data are converted from [mg] (the unit of measure in their standard log) into [g], according to the rule adopted by the MLC core (see the LSM6DSOX MLC app note:(

0693W00000GZUxbQAH.png 

You can also find the following statements in the same application note:

0693W00000GZW1jQAH.png0693W00000GZVzpQAH.pngIf my reply answered your question, please click on Select as Best at the bottom of this post. This will help other users with the same issue to find the answer faster. 

-Eleon

View solution in original post

2 REPLIES 2
Eleon BORLINI
ST Employee

Hi @GHead.1​ ,

that's correct, there is a 1/1000 multiplier because the accelerometer data are converted from [mg] (the unit of measure in their standard log) into [g], according to the rule adopted by the MLC core (see the LSM6DSOX MLC app note:(

0693W00000GZUxbQAH.png 

You can also find the following statements in the same application note:

0693W00000GZW1jQAH.png0693W00000GZVzpQAH.pngIf my reply answered your question, please click on Select as Best at the bottom of this post. This will help other users with the same issue to find the answer faster. 

-Eleon

Hi Eleon,

Thank you for your reply. That has cleared up my confusion.

Might I recommend that you please update the MLC app note to explicitly state that this conversion is occurring? I understand it is implied by the section you quoted; however, I think it would likely save others the time and confusion I have encountered.

Moreover, it is also critical to mention that the gyroscope is also scaled to entirely different units from the units of the standard log. Namely, degrees per second is converted to radians per second (multiply by pi / 180). If you could please update/edit your answer to include this fact as well, I will happily select it as the best. I would just prefer the complete answer to be in a single post for any future readers.

Kind regards,

Greg