TensorFlow Lite - Magic Wand

材料准备

  • AmebaD [AMB21 / AMB22 / AMB23 / BW16] x 1

  • Adafruit LSM9DS1 加速感测器

  • LED x 2

范例说明

流程

AMB21/AMB22 接线图:

如下图,将加速感测器和LED连接到 AMB21 / AMB22 开发板上。

../../../../_images/image12.jpeg

AMB23 Wiring Diagram: For AMB23, we will use the onboard LEDs on the board itself.

../../../../_images/image1-1.jpeg

BW16 Wiring Diagram: For BW16, we will use the onboard LEDs on the board itself.

../../../../_images/image1-2.jpeg

BW16-TypeC Wiring Diagram: For BW16-TypeC, we will use the onboard LEDs on the board itself.

../../../../_images/image1-36.png

从以下网址下载TensorFlow Lite for Microcontrollers的Ameba版本 https://github.com/ambiot/ambd_arduino/tree/master/Arduino_zip_libraries

请按照以下说明进行安装操作 https://docs.arduino.cc/software/ide-v1/tutorials/installing-libraries

确保在以下位置找到patch文件并安装 https://github.com/ambiot/ambd_arduino/tree/master/Ameba_misc/

在Arduino IDE库管理器中,安装Arduino_LSM9DS1 库。此范例已使用 LSM9DS1 库的 1.1.0 版进行了測試。

Open the example, "Files" "Examples" “TensorFlowLite_Ameba” “magic_wand”.

../../../../_images/image21.jpeg

上传代码并在上传完成后按Ameba上的重置按钮。

保持加速感测器稳定,使x轴的正极指向右侧,z轴的正极指向上方,按照所示形状移动加速感测器,使其平稳运动1至2秒钟,避免剧烈运动。

../../../../_images/image32.jpeg

If the movement is recognised by the Tensorflow Lite model, you should see the same shape output to the Arduino serial monitor. Different LEDs will light up corresponding to different recognized gestures. Note that the wing shape is easy to achieve, while the slope and ring shapes tend to be harder to get right.

../../../../_images/image42.jpeg

程式码说明

有关TensorFlow Lite for Microcontrollers的更多信息,请参考以下网址: https://www.tensorflow.org/lite/microcontrollers