RTL8722DM supporting TensorFlow Lite “Micro Speech” Example - Page 1
Forum section: electronics / projects

author: dakamaster
author_rank: Newbie
timestamp: July 12, 2021, 09:31:53 am
content: Introduction to Google TensorFlowTensorFlow (TF) is an end-to-end open-source platform for machine learning. It has a comprehensive, flexible ecosystem of tools, libraries, and community resources that lets researchers push the state-of-the-art in ML, and developers easily build and deploy ML-powered applications.TensorFlow Lite for MicrocontrollersWhile TensorFlow Lite (TFL) for Microcontrollers is designed to run machine learning models on microcontrollers and other devices with only a few kilobytes of memory. The core runtime just fits in 16 KB on an Arm Cortex M3 and can run many basic models. It doesn't require operating system support, any standard C or C++ libraries, or dynamic memory allocation.Ameba and TFL for MicrocontrollersAmeba is an easy-to-program platform for developing all kinds of IoT applications. AmebaD is equipped with various peripheral interfaces, including WiFi, GPIO INT, I2C, UART, SPI, PWM, ADC. Through these interfaces, AmebaD can connect with electronic components such as LED, switches, manometer, hygrometer, PM2.5 dust sensors, …etc.“Micro Speech” ExampleMaterialsAmeba D [RTL8722 CSM/DM] x 1 or Ameba D- MINIAdafruit PDM MEMS microphoneLED x 4In this example, we will use Ameba D as an example, however, the microcontroller EVB using in the video link above is Ameba D-mini.ProcedureConnect the microphone and LEDs to the RTL8722 board following the diagram.How to get the code?Download the Ameba customized version of TensorFlow Lite for Microcontrollers library at:https://github.com/ambiot/ambd_arduino/tree/master/Arduino_zip_libraries.Follow the instructions athttps://www.arduino.cc/en/guide/librariesto install it.Ensure that the patch files found athttps://github.com/ambiot/ambd_arduino/tree/master/Ameba_misc/are also installed.Open the example,“Files” -> “Examples” -> “TensorFlowLite_Ameba” -> “micro_speech”.Upload the code and press the reset button on Ameba once the upload is finished.Expected BehaviorOnce it is running, you should see one of the LEDs flashing, indicating that it is processing audio. Saying the word “yes” will cause the green LED to light up. Saying the word “no” will cause the red LED to light up. If the word is not recognized, the blue LED will to light up.The inference results are also output to the Arduino serial monitor, which appear as follows:If you are having trouble getting the words recognized, here are some tips:Ensure that your surroundings are quiet with minimal noise.Experiment with varying the distance of the microphone, starting with it at an arm’s length.Experiment with different tones and volumes when saying the words.Depending on how you pronounce the words, the characteristics of the microphone used, getting one keyword recognized may be easier than the other.Reference and Q&A1. More information on TensorFlow Lite for Microcontrollers can be found at:https://www.tensorflow.org/lite/microcontrollers2. For more examples, please visit our official website: bit.ly/ambiot13. Please join our FB Forum (English version) to further discuss with us:https://bit.ly/2Tzgxkv4. Or join our forum to bring up any questions:https://bit.ly/ambiotforum