The project implements chapter 8 of the book TinyML: Machine Learning with TensorFlow Lite on Arduino and Ultra-Low-Power Microcontrollers to support a speech recognition feature on a microcontroller.
Configure TrainingThe start code the project uses is here. By redefining the training words list, and tuning hyperparameters like learning rate, and training steps, the configuration is set:
Training these words: left,right
Training steps in each stage: 12000,3000
Learning rate in each stage: 0.001,0.0001
Total number of training steps: 15000
Begin TrainingAfter the setup of the configuration, some scripts are utilized to start the training. For monitoring the training process, TensorBoard is used, and TensorBoard can keep track of scalar data like accuracy, cross-entropy, etc. In addition to graphs, inputs fed into the model are supported as well.
Freeze GraphOnce the training process is finished, freezing kicks is a technique to have a static representation of the graph with the weights frozen into it. The frozen graph gets output to a file, and it gets loaded by TensorFlow to run inference.
DeploymentConverting the trained model to TensorFlow Lite is essential since the project is running on a microcontroller. After converting the model via toco, the command-line interface for the TensorFlow Lite converter, the TensorFlow Lite model gets further transferred into a C array. Things are ready for deployment after replacing the model data (C array) and labels from the Ardunio micro speech template.
Result
Comments