Skip to main content

True TinyML with Weights & Biases (building sound classifier)

W&B as Tiny ML tooling
Created on December 12|Last edited on January 9




Abstract

The world of tiny ML has its foundations in many ubiquitous applications such as wake word detection (Alexa, ok google, Siri) however this has recently taken off in the open source community with democratically accessible devices such as the raspberry pi pico and other such microcontrollers. True TinyML applications run on microcontrollers with only several hundred kilobits of ram, no operating system, and can perform continuous inference on extremely low amounts of power. This is small for three reasons:
  1. Micro Wats of power of inference;
  2. limited ram;
  3. physically tiny
Tasks such as language comprehension, and face recognition that are inherently more complex are not suitable to use cases, however, these are also tasks that can operate on larger edge devices but are still very resource-intensive, tiny ML is more in the realm of switch-type tasks that initiate more complex, sophisticated and resource intensive tasks, where constant listening/real-time inference takes place. In this webinar, we train a model from scratch using Tensorflow Light, evaluate and tune a tiny ml model (showing both quantitative and qualitative results) using W&B in a step-by-step easy to follow and reproducible example. We also monitory inference back from the device and show that TinyML production in Truly possible with W&B.

Well cover a step by step:
  1. Data storage and acquisition and versioning;
  2. Pre-processing and data visuality;
  3. Hyperparameter tuning;
  4. Model registry;
  5. Deployment and monitoring.



How small is Tiny?

Enter the Micro Controller

Presently there are a growing number of edge applications such that are typically similar that devices such as Nvidia Jetson, or mobile phones.
Edge Impulse enabled users to connect to edge devices and weights and biases can be installed on any device that can have an operating system. There are devices however known as microcontrollers that have much more limited constraints, these devices typically have ram in the order of kilobytes and pre-compiled models and programs.
These devices cannot have full python and generally run best on C++ compiled binaries. Edge impulse has developed methods for codeless deployment and conducting data pre-processing pipeline in

Setup

  1. 

Dataset

This is a snapshot of the Dataset from EdgeImpulse
This is the dataset in W&B Table. You can play the audio files within the Tables itself to listen to the audio files.

Run: upbeat-dust-1333
1


Training 🏃🏻‍♀️

Running and training Sweeps: W&B EI custom block integration:

Training Weights & Biases Sweep 🧹

Weights and Biases integrated sweep block can automatically train a sweep for a super big set of hyperparameter including activation function, batch size, convolutional kernel, and optimizer type and we have included optimizer parameters. Sweeps are a really powerful way of finding the optimal training parameters.
Here we perform a random sweep and can see some unexpected results (Gelu) or Gaussian Error Linear Unit as the activation function provides the best validation accuracies. We can also see here which models learn through the training and model parameters.
Further, you can see that GFLOPs (Giga Floating Point Operations) is also associated with kernel size, (which is what you would expect) and that Adamax and Nadam optimizers provide slightly better results.


Run set
0

Follow the links in the User Guide section to learn more about Sweeps.

Validation Metrics

Training Metrics

Test Set (unseen data)