After trying some TinyML models, I found my interests in word detection project and decided to train my model to recognize words other than "yes" and "no". And the model is trained to recognize "left" and "right".
Experiment(1)Trainamodel
Colab notebook was used to train the model for its convenience. According to the notebook, training a new model involves with five steps.
a. Configure training
The wanted words "yes, no" were replaced with"left, right". And "training steps" was improved to 15000 to achieve a high accuracy.
b. Instal the correct dependencies
c. Monitor training using TensorBoard
d. Training
It took about 2 hours and 20 minutes to finish the training. And the result could be seen as the picture below.( I set the smoothing at 0.999 to make it looks beautiful.)
e. Generate a TensorFlow Model for Inference (freeze a model)
Because the model cannot be further retrained, it's necessary to combine relevant training results into a single file for inference.
f. Convert to Tensorflow Lite
g. Create a C array
This C array would be used to replace the array in the old model. So it should be stored or downloaded on computer.
(2) Use the model in the project
a. Replace the original model data with new model
Open micro_features/tiny_conv_micro_features_model_data in the text editor, and then replace the arrays.
b. Update the labels
c. Update command_responder.cc
(3) Run the model
The results turns out to be like that. It could distinguish "left" and "right" with a good accuracy.
Thanks for my friends Yanpeng QI and "the best jungle in the world" to help me with finishing this project.
Comments
Please log in or sign up to comment.