Jasper Wang’s blog

In a quiet place, a person can hear his own thoughts.

Final Project

Posted at — May 3, 2020

Recently, I am still focused on the Machine Learning Process by going through the chapters in the Tiny ML book. I think now I have a general understanding of machine learning workflow. But I can still not start a project from scratch. The book first went through all the steps on the operation side, which is the hardware, before deployed to the micro controller, it’s better to run the test on the computer. Then the following chapter will explain how to tarin the model and how the model works. Finally, it shows how to train our own model.

I chose to train another Wake-Word Detection model. In the example, the micro controller can recognize the word “yes” and “no”. Honestly, it is not super actuate when I was playing with the demo. Given the ablity that I can use an existing data to train a few more words, I decide to give it a try.


I decided to train the word “up” and “down”.


First, it comes with some customzie user settings, I change the WANTED_WORDS to be the ones I want. Then, I can change the TRAINING_STEPS and LEARNING_RATE. Training steps refers to the numner of times a batchof training data will be run through the network. Learning rate sets the rate of adjustment. It did the work to change the model’s weights and biases over the time. I did not change the number here.

Then I setup the environment, delete the old data, load the tensor board.

Next, I start the training process. I can see the graph shows in the tensor board.




During the training process. I can see the validation happens periodicly, shown in the red lines.



Nearly about an hour hour, the training finsied. The accuracy is kept gping up, and the loss went down.




From the result, I can see that the accuracy = 86.6%, which seems okay but not prefect.

Next, I generate the TensorFlow Model, then convert it to the TensorFlow Lite Model for Micro Controllers.

Finally, I ended up having a model.cc file.

By now, I have finished the training process.

To test it on the Arduino, I shoild modify the code in Arduino. First, I replaced all the array in micro_features_tiny_conv_micro_features_model_data.cpp. file. Then, I change the classes in the micro_features/micro_model_settings.cc file.

After all these, I can upload it to my board and do the test.

The result is just okay, not super accurate, the success rate is about 70%.

I think have a result like this cannot be applied in real practice. I’m looking forwoard to see more posiiblities to improve the model.