Qiao Kang
Zhuang Wang
2. OverviewThe goal of this project is to train a Machine Learning model to recognize certain words (i.e., "yes" vs. "no") and run the model in a Arduino Nano 33 BLE device. Upon detection of different words, the device turns on LEDs with different colors (e.g., green for "yes" and red for "no").
3. Model TrainingWe follow the instructions in Train a Simple Audio Recognition Model tutorial to train a speech recognition using TensorFlow. Below we briefly review the model training process.
First, we need to configure a set of parameters, for instance, which words we would like the device to recognize. In this project, we train "yes" vs. "no".
WANTED_WORDS = "yes,no"We keep other parameters as default.
After installing tensorflow and other dependencies, we start the training process by running the `train.py` script. This script downloads an open-accessed audio dataset (published by Google). We can also use our own data for training, but in this project we use the public dataset. Training takes about 2 hours to finish.
python tensorflow/tensorflow/examples/speech_commands/train.py \
.....Because the device does not support float point numbers, we need to convert the trained model into a quantized model, i.e., a TensorFlow Lite Model. This can be done by invoking `TFLiteConverter`.
tflite_model = converter.convert()We then need to generate a C source file so that it can be uploaded.
4. Uploading model to Arduino NanoNext, we need to upload the trained model into the Arduino device. First, we need to replace micro_features/tiny_conv_micro_features_model_data.cc with the C source file that we just generated.
Next, we load the project into Arduino IDE, compile and upload to the device.
5. DemoThe videos below show that our model can successfully recognize "yes" vs. "no".







Comments