element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • More
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • More
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • More
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • More
  • 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
Design For A Cause 2021
  • Challenges & Projects
  • Design Challenges
  • Design For A Cause 2021
  • More
  • Cancel
Design For A Cause 2021
Blog Trakcore #2 AI Assisted Posture Modification - Acquiring Data and Designing a Model
  • Blog
  • Forum
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
Author: vlasov01
Date Created: 20 Mar 2021 11:40 AM
Views: 250
Likes: 4
Comments: 5
  • neural network
  • anomalydetection
  • ai at the edge
  • greengrass
  • tinyml
  • accuracy
  • design for a cause - design challenge
  • posture classification
  • designforcause arduino
  • edge impulse
  • aws iot
  • edge processing
Related
Recommended

Trakcore #2 AI Assisted Posture Modification - Acquiring Data and Designing a Model

vlasov01
vlasov01
20 Mar 2021

Design for A Cause 2021Trakcore #1 AI Assisted Posture Modification - Project Introduction

#1 - Project Introduction

#2 - Acquiring Data and Designing a Model

#3 - Deploying and Testing Edge Impulse ML Model on Arduino Nano 33 IoT

#4 - Enabling IMU and BLE with Edge Impulse ML on Arduino Nano 33 IoT

#5 - Using Cordova Bluetooth (BLE) Plugin to Connect Arduino Nano 33 IoT with Android Phone

#6 - Arduino Nano 33 IoT Wearable Design

#7 - Adding Pedometer to Reduce False Positives

#8 - Refining User Experience AKA Bugs Fix

 

Changing the plan

 

As we've got some delay with shipping of Arduino Nano 33 IoT in the supply chain I've adjusted my project plan. I'm starting with data collection, model design and test instead of starting with MVP (minimal viable product). I was planning to collect data for the model using MCU.

 

Platform decision

 

My device should be able to recognize human activities - if person is sitting or active (walking, running). And if a person is sitting it should detect straight and curved positions.

I've took a very good Coursera Introduction to Embedded Machine Learning training in preparation for this project. This course used Edge Impulse platform for data collection, model design and testing. It used a phone and Arduino Nano 33 BLE for its projects. I found the platform easy to use and quite effective. And there is no additional cost for most of developers. It provides a quite complete and streamlined approach to AI in embedded world. They have several examples related to continuous movement use case, where data collected from accelerometer. Edge Impulse doesn't directly supports Arduino Nano 33 IoT, but it seems the generated Arduino library can be used with Arduino Nano IoT. I've considered as well AWS IoT Greengrass in combination with AWS IoT Greengrass ML and AWS SageMaker. It is very powerful and has a lot of capabilities like device management, security, inference at the Edge, But I found the learning curve a bit too steep and I'm concerned about its memory requirements as I was not able to find any examples for Arduino Nano 33 IoT or Arduino Nano 33 BLE. As well use of AWS IoT Greengrass on edge requires a more powerful compute, capable of running Linux like RPi. Alternative option to perform inference in the AWS cloud will require sending sensor data from MCU over radio. It will drain batteries pretty fast in continuously running mode. As well it may have some negative privacy implications.

 

So I've decided to use Edge Impulse platform for my project for inference. I may use AWS IOT for the device management.

 

Options to collect accelerometer sensor data

It was recommended in my Coursera Introduction to Embedded Machine Learning training to use the same sensor for training model data collection as for inference. But Jan Jongboom,  co-founder and CTO at Edge Impulse, suggested that for my specific use case I can use a phone as a sensor as it translates surprisingly well to on-device inference. I'll verify it once  MCU will be delivered.

 

Collecting accelerometer sensor data from a phone

Edge Impulse provides a very convenient tool for data collection on a phone. It is very easy to load and use. It doesn't require any app installation or credentials. I've just scanned a provided QR code. Once a mobile phone load a web page related to QR code it as well loads WebAssembly. After that I've granted permission to access accelerometer it was ready to collect data.

I've attached the phone to my back on a cardigan using a running armband.

 

 

But I've got some minor challenges too. My phone was going into lock mode after capturing several 10-seconds samples. Sometimes the size of the sample was 0 seconds. So I've deleted them. Sometimes the WebAssembly was not able to upload data.

 

Data collection for Curved vs. Straight position

 

I've collected a training data set for position. This data set is used to build a model. Each data sample must be labeled with a straight or curved position label.

Then I've collected a test data set. This data set is used to validate the model. The size of my test is 30% of the training data set.

I've selected two components for my model. Flatten to classify and Spectral Analysis for anomaly detection. I've added anomaly detection based on recent recommendation by an engineer Jenny Plunkett from Edge Impulse during recent webcast Industrial-Grade TinyML Applications with Silicon Labs and Edge Impulse! (Win a Thunderboard Sense 2!). I may revisit my choice later.

Than I trained model. The accuracy on the training set was 100%. And the size of the model (1.5k peak RAM usage, 15.8kb ROM usage) should easily fir into MCU, which has 256kb of flash and 32kb of SRAM. But I'll still need to account for the network stack.

 

I've decided to add anomaly detection block to account for unclassified cases. After some exploration I've adjusted minimum score before tagging as anomaly to 0.50. And I still need to learn more about it.

Than I've run the most important test to validate my model on the test dataset. The accuracy as expected went a bit down from 100% to 96.76%.

So far I'm pretty happy with Impulse Edge platform. It is easy very easy to use. And its community was very helpful in answering my questions.

 

The next steps will be to deploy and validate this model on Arduino Nano 33 IOT.

 

Thank you for reading my project blog post!

 

References

Run ML Models at the Edge with AWS Greengrass ML

Industrial-Grade TinyML Applications with Silicon Labs and Edge Impulse! (Win a Thunderboard Sense 2!)

Anonymous

Top Comments

  • DAB
    DAB 11 months ago +1

    Nice update.

     

    DAB

  • vlasov01
    vlasov01 11 months ago in reply to DAB

    Thank you DAB!

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
  • DAB
    DAB 11 months ago

    Nice update.

     

    DAB

    • Cancel
    • Up +1 Down
    • Reply
    • More
    • Cancel
  • aspork42
    aspork42 over 1 year ago in reply to vlasov01

    Aahh- I see now. Thanks!

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
  • vlasov01
    vlasov01 over 1 year ago in reply to aspork42

    Thank you for the question. I've attached it to my back on a cardigan using a running armband. I've updated the post with the picture.

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
  • aspork42
    aspork42 over 1 year ago

    So do you have the phone in your pocket to gather the data?

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
Element14

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 © 2022 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

  • Facebook
  • Twitter
  • linkedin
  • YouTube