An overview of how to use the Machine Learning Toolkit (MLTK) to develop models for embedded devices
Use the arrows to navigate,
left/right and up/down
Hint: You can also use your keyboard's arrows
Model Design - PC/Cloud
Model Execution - Embedded Device
Acquire, Analyze & Preprocess Dataset
Design & Train
Model
Evaluate & Profile
Model
Quantize & Compile
Model
Model Binary
Preprocess Data
Model
Interpreter
Post-process
Interpreter Results
Firmware Application
Handles Results
Raw Sensor Data
The first and most important step of model development is acquiring a representative dataset
To create a robust model, the data used to train the model must be similar to the data the embedded device will see in the field
The dataset is typically application-specific
The MLTK comes with reference datasets
For many machine learning applications, acquiring a representative dataset may be challenging.
Many times the dataset will suffer from one or more of the following:
A clean, representative dataset is one of the best ways to train a robust model. It is highly recommended to invest the time/energy to create a good dataset!
AudioFeatureGenerator - a library to convert streaming audio into spectrograms for classification by a Convolutional Neural Network (CNN)
view_audio - command to visualize real-time audio samples as a spectrogram
classify_audio - command to classify real-time microphone audio
> mltk view_audio
> mltk classify_audio
Create
Model Specification
Profile Model
Train Model
Evaluate Model
Copy .tflite model file
into Gecko SDK Project
Profile the model before training to ensure it fits within the hardware constraints
Evaluate trained model to see how well it can make predictions on unseen data samples
The output of model training is an archive file containing the trained model files
The model specification is a single Python script containing everything needed to design, train and evaluate the model
The .tflite model file is loaded into the Tensorflow-Lite Micro Interpreter which executes on the embedded device
Model Specification
.py
Keras Model File
.h5
TF-Lite Model File
.tflite
Model Archive
.mltk.zip
The configuration defined in the model specification file is given to Tensorflow to train the model
The output of Tensorflow, the trained model, is a Keras .h5 model file
The Keras .h5 file is given to the Tensorflow-Lite Converter to generate a quantized, .tflite model file
The quantized, .tflite model file is programmed into the embedded device
The output of MLTK train command also generates a model archive file which contains all of the model files and training logs
TF-Lite Model File
.tflite
The MLTK adds additional parameters to the .tflite model file which the Gecko SDK parses during project generation