element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Ralph Yamamoto's Blog Using SensiML with Arduino Nano 33 BLE Sense - Model Development
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: ralphjy
  • Date Created: 7 Feb 2021 4:12 AM Date Created
  • Views 1547 views
  • Likes 4 likes
  • Comments 6 comments
  • quicklogic
  • arduino nano 33 ble sense
  • tinyml
  • sensiml
  • edge impulse
Related
Recommended

Using SensiML with Arduino Nano 33 BLE Sense - Model Development

ralphjy
ralphjy
7 Feb 2021

This is a continuation of my previous post Using SensiML with Arduino Nano 33 BLE Sense - Data Capture .

 

In preparation to building a model in Analytics Studio, I needed to capture a larger dataset using Data Capture Lab.  I am going to try to recognize motion along each accelerometer axis using data from the accelerometers and gyros.

 

I have 4 data classes that I showed previously:

  1. Idle - no motion
  2. UpDown - motion along the Z-axis
  3. LeftRight - motion along the Y-axis
  4. ForwardBack - motion along the X-axis

 

I captured 20 data sets with each of the data classes within each set and then I segmented and labeled the data.  I added an additional metadata tag "Data Set" to differentiate data used for training and data used for testing.  I tagged 4 of the 20 sets (20%) for test as shown in the Project Explorer of DCL.

 

image

 

All of the data sets were 20 seconds in duration with a 119 Hz sample rate.  The amount of motion and spacing was somewhat variable.  Below is a representative sample.

image

 

SensiML Analytics Studio

Analytics Studio is a web browser based application that you log into with your SensiML account.

Projects that you create in Data Capture Lab will show up in Studio, as will the captured data.

image

 

 

Here's a diagram of the tool flow:

image

 

And a diagram of the Analytic Studio Flow:

image

 

The Summary page for the project - I'm just starting so the only thing currently showing is the 20 Captured data sets plus a picture that I added:

image

 

Prepare the data

The first step to building a model is to prepare the training data set.  This is done by creating a query to extract the data from the data set.  Here is the query that I created.  You can see that 16 instances of each class was extracted from the data set.

image

 

Build the model

It turns out that you can build the model within Analytics Studio using AutoML or you can also build it externally using Google Colab and TensorFlow Lite Micro.  SensiML recently did a webinar on using the external process https://sensiml.wistia.com/medias/l72tofdz9j , but I don't have access to the Colab Notebook so I'll use the AutoML flow.

 

The SensiML models are called "pipelines" as opposed to Edge Impulse models which are appropriately called "impulses".

 

The pipeline uses the data query as its input.  Then you select a segmenter - I chose an approx. 2 second window in which the data is classified.  Then select an optimization metric - I chose f1-score.

 

Optimization metric choices:

image

 

And then a target model size to define the SRAM usage.  It defaults to 32K, but I could increase this parameter if necessary as the BLE Sense board has 256K of SRAM.

 

There are also some advanced settings to optimize pipeline parameters.  This is something that I'll need to learn more about:

image

 

After setup, you press the "Optimize" button and it runs AutoML and presents the results of the top 5 models.

 

Here is my pipeline with the optimization results:

image

 

Here is the Model Visualization showing the feature separation:

image

 

And the Confusion Matrix:

image

 

And Feature Summary:

image

Test the Model

Now to select the 4 Test data sets and verify performance.

image

 

And the results are not that good.  But the reason is apparent when looking at the Confusion Matrix:

image

 

The problem is with the Idle class.  I'll need to go back and look at the training and test data and maybe try different window sizes.  I'm testing with data sets that have all 4 classes within the set and variable spacing between the classes.  I think I'll make sure there isn't any issues with simpler test data.

 

So much to learn, but I think using these tools might actually help me figure out how this all works image......

  • Sign in to reply

Top Comments

  • fmilburn
    fmilburn over 4 years ago +2
    Hi Ralph, That is very interesting. It looks like setting up the model is easier and more automated in AutoML than when I was trying out Colab. I got pretty excited when I saw the training data before…
  • ralphjy
    ralphjy over 4 years ago in reply to fmilburn +2
    Hi Frank, What types of stuff have you tried in Colab? Anything using SensiML? The only SensiML example that I see is the "Boxing Punch Gesture Recognition" notebook that they use in the TensorFlow Lite…
  • fmilburn
    fmilburn over 4 years ago in reply to ralphjy +2
    I took a free introductory course about Colab to understand how a trained model could be migrated to a Raspberry Pi. I didn’t have a use case at the time so it was mostly just an exercise to help me understand…
  • ralphjy
    ralphjy over 4 years ago in reply to DAB

    There are little "?"s next to the settings that provide basic info, e.g. this one for the Strip Mean setting.

    image

     

     

    Here is the link to their docs for AutoML parameters https://sensiml.com/documentation/analytics-studio-notebook/sensiml-automl.html

    Doubt if you will get a lot of insight into the algorithms.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • ralphjy
    ralphjy over 4 years ago in reply to fmilburn

    Thanks for that info.  I was looking for something specific to SensiML.  I think I found what I needed in their documentation.  You might find this interesting - they have a set of tutorials for Analytics Studio Notebook on github.  https://github.com/sensiml/AnalyticStudioTutorials

     

    Probably makes sense to run all these notebooks in Colab.   I should be able to customize them for what I need.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 4 years ago

    Interesting results.

     

    Is there a verbose feature that allows you to look more deeply into what the algorithms do with the data?

     

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • fmilburn
    fmilburn over 4 years ago in reply to ralphjy

    I took a free introductory course about Colab to understand how a trained model could be migrated to a Raspberry Pi.  I didn’t have a use case at the time so it was mostly just an exercise to help me understand what ML does. I posted one not particularly useful exercise here.  I thought the course pretty good for someone like me with no background as an introduction.



    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • ralphjy
    ralphjy over 4 years ago in reply to fmilburn

    Hi Frank,

    What types of stuff have you tried in Colab?  Anything using SensiML?

    The only SensiML example that I see is the "Boxing Punch Gesture Recognition" notebook that they use in the TensorFlow Lite Tutorial.  I guess I should be able to adapt that one.

    Ralph

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube