Skip to main content
Explorer II
December 3, 2024
Solved

Problems with AFS tool on MEMS Studio -- bad data?

  • December 3, 2024
  • 6 replies
  • 2487 views

Tools/Software/etc:

  • SensorTile.box PRO with DATALOG2_Release firmware
  • STBLE Sensor app (to trigger data collection)
  • hsdatalog_to_unico.py
  • MEMS Studio v1.4.1
  • Ubuntu Linux 24.04

I watched a handful of webinars and read through tutorials related to the LSM6DSV16X's machine learning core. Most of these covered the basics, but only the basics (as in, they only show the most barebones demonstration with a single sample of a single simple movement). When attempting to generate a decision tree on my own using custom data, I ran into several problems.

First, I collected 4 samples of a basic jab motion and labeled the data "strike" and "retract" for each. Everything worked up to the point where I generated the decision tree and got a confidence value of 0%. Then, I attempted to simplify the data and only use one sample of one movement (just the strike component). At this point, I began to see the error below when running the AFS tool. 

Screenshot from 2024-12-03 12-51-46.png

I collected new samples, this time a simpler and slower bicep curl movement:

Screenshot from 2024-12-03 13-38-06.png

Even with the new data, I continue seeing the same error when running the AFS tool. Is this a bug, or something I'm doing wrong? My goal is to eventually detect baseball swings and use the interrupt from the MLC as a trigger for storing high-frequency IMU data, but at the moment I'm not able to successfully produce a configuration for the MLC using simple movements.

    This topic has been closed for replies.
    Best answer by Miroslav BATEK

    Hello @rbmarcus,

    I have analyzed your project. Unfortunately there is an issue in MEMS Studio in saving the labeled data in Data Analysis tool. This caused data corruption and the logs cannot be process by the AFS tool.

    A workaround could be split the unprocessed log in different tool or acquire the data for each class separately and don't use the Data Analysis to split the data.

    We are planning to release new version of MEMS Studio with the bug fix this week.

    I'm sorry for inconvenience.

    6 replies

    rbmarcusAuthor
    Explorer II
    December 3, 2024

    I tried again by setting explicit labels for the "up" and "down" motion of a bicep curl. When I add two samples of each, I get the error below:

    Screenshot from 2024-12-03 14-46-34.png

    When I only add one sample of each, I successfully run the AFS, generate the ARFF file, and get an error on the decision tree generation step.

    Screenshot from 2024-12-03 14-48-37.png

    I wish more context would be provided when these errors are flagged. Script error tracebacks don't provide sufficient information about what exactly I'm doing to wrong in order to troubleshoot this independently. I also haven't found any online forum posts or documentation about these errors, so I'm assuming it's some sort of issue specifically related to my setup and/or data.

    rbmarcusAuthor
    Explorer II
    December 9, 2024

    Still struggling with this problem and I haven't found a solution online or through testing yet. Does anyone have information on this or personal experience with successful model training using MEMS Studio?

    Technical Moderator
    December 12, 2024

    Hi @rbmarcus ,

    Can you share your project? Otherwise we are not able to replicate your issue.

     

    Thanks!

    rbmarcusAuthor
    Explorer II
    December 12, 2024

    @Federica Bossi thank you for getting back to me. I attached a zip file containing the processed and unprocessed logs, along with the MLC config json for my most recent attempt this morning. I also outlined my process below.

    1. Connect STbox.Pro to MEMS Studio, set accelerometer and gyroscope range.

    Screenshot from 2024-12-12 09-13-07.png

    2. Only enable timestamp, accelerometer, and gyroscope in the Save to File tab for datalogging.

    Screenshot from 2024-12-12 09-13-47.png

    3. Label data using the Data Analysis tool.

    Screenshot from 2024-12-12 09-21-00.png

    4. Add the labeled data to the machine learning workspace, select LSM6DSV32X as the sensor.

    Screenshot from 2024-12-12 09-22-30.png

    5. Attempt to run the AFS tool.

    Screenshot from 2024-12-12 09-49-47.png

    I tried a variety of configurations on the AFS window between ML ODR, window length, selecting just accelerometer or just gyroscope, disabling certain outputs, removing samples, etc. but I always get one of these errors.

    error15hz60win.png

    error130hz60window.png

    ST Employee
    December 17, 2024

    Hello @rbmarcus,

    I have analyzed your project. Unfortunately there is an issue in MEMS Studio in saving the labeled data in Data Analysis tool. This caused data corruption and the logs cannot be process by the AFS tool.

    A workaround could be split the unprocessed log in different tool or acquire the data for each class separately and don't use the Data Analysis to split the data.

    We are planning to release new version of MEMS Studio with the bug fix this week.

    I'm sorry for inconvenience.

    rbmarcusAuthor
    Explorer II
    December 18, 2024

    No worries, thank you for taking a look and explaining the root cause. I'll investigate other methods of splitting the data in the meantime. 

    ST Employee
    March 11, 2025

    @rbmarcus I'm sorry you have an issue with the tool.

    Would you please share also the MLC project so I can try to replicate it. Your data looks OK, maybe there is some issue with MLC project file.

    rbmarcusAuthor
    Explorer II
    March 11, 2025

    @Miroslav BATEK please see below. I reduced the number of patterns to 3 per label for ease of sharing but I get the error regardless of the amount of data I include. Is anything else required on your end aside from the MLC configuration file?

    {
     "accelerometer_fs": "8 g",
     "accelerometer_odr": "1920 Hz",
     "datalogs": [
     {
     "filename": "/home/rbmarcus/Desktop/rbmarcus_logs_2/Processed_Log_25_03_10_09_24_53_up_03.csv",
     "label": "up"
     },
     {
     "filename": "/home/rbmarcus/Desktop/rbmarcus_logs_2/Processed_Log_25_03_10_09_24_53_up_02.csv",
     "label": "up"
     },
     {
     "filename": "/home/rbmarcus/Desktop/rbmarcus_logs_2/Processed_Log_25_03_10_09_24_53_up_01.csv",
     "label": "up"
     },
     {
     "filename": "/home/rbmarcus/Desktop/rbmarcus_logs_2/Processed_Log_25_03_10_09_24_53_down_03.csv",
     "label": "down"
     },
     {
     "filename": "/home/rbmarcus/Desktop/rbmarcus_logs_2/Processed_Log_25_03_10_09_24_53_down_02.csv",
     "label": "down"
     },
     {
     "filename": "/home/rbmarcus/Desktop/rbmarcus_logs_2/Processed_Log_25_03_10_09_24_53_down_01.csv",
     "label": "down"
     },
     {
     "filename": "/home/rbmarcus/Desktop/rbmarcus_logs_2/Processed_Log_25_03_10_09_24_53_idle_03.csv",
     "label": "idle"
     },
     {
     "filename": "/home/rbmarcus/Desktop/rbmarcus_logs_2/Processed_Log_25_03_10_09_24_53_idle_02.csv",
     "label": "idle"
     },
     {
     "filename": "/home/rbmarcus/Desktop/rbmarcus_logs_2/Processed_Log_25_03_10_09_24_53_idle_01.csv",
     "label": "idle"
     }
     ],
     "decision_tree_count": "1",
     "features": [
     ],
     "filters": [
     ],
     "gyroscope_fs": "2000 dps",
     "gyroscope_odr": "1920 Hz",
     "input_type": "accelerometer+gyroscope",
     "max_dectrees": 4,
     "max_results_per_dt": 16,
     "mlc_odr": "240 Hz",
     "name": "LSM6DSV16X",
     "subgroups_per_dt": 4,
     "thresh_accu_to_take_default": 0.05,
     "thresh_n_percentage_default": 0.05,
     "window_length": "60"
    }

     

    ST Employee
    March 12, 2025

    Thank you. I was able to replicate the issue and we are analyzing it.

    It seems the error is triggered if you want to calculate Windows length + Filters + Features, but in case of separate Windows length and Filters + Features calculation the error doesn't appear. Maybe you can use this two step approach as temporary workaround.

    ST Employee
    July 21, 2025

    Hello Thomas,

    I'm sorry for that. Would you please share with me the the source logs from Datalog2 and saved .csv files so I can analyze it? Thank you.