TensorFlow Lite - Person Detection

Materials

• AmebaD [ AMB23 / AMB21 / AMB22 / BW16 / AW-CU488 Thing Plus / AMB25 / AMB26 ] x 1
• Arducam Mini 2MP Plus OV2640 SPI Camera Module x 1
• LED x 3

Example

Procedure

1. Download the Ameba customized version of TensorFlow Lite for Microcontrollers library at https://github.com/ambiot/ambd_arduino/blob/master/Arduino_zip_libraries/Ameba_TensorFlowLite.zip. Follow the instructions at https://www.arduino.cc/en/guide/libraries to install it.
2. Download Ameba_ArduCAM library at https://github.com/ambiot/ambd_arduino/blob/master/Arduino_zip_libraries/Ameba_ArduCAM.zip. Follow the instructions at https://www.arduino.cc/en/guide/libraries to install it.
3. In the Arduino IDE library manager, install the “JPEGDecoder” library. This example has been tested with version 1.8.0 of the “JPEGDecoder” library. Once the library has been installed, you will need to configure it to disable some optional components that are not compatible with the RTL8722DM. Open the following file:
– Arduino/libraries/JPEGDecoder/src/User_Config.h
Make sure that both “#define LOAD_SD_LIBRARY” and “#define LOAD_SDFAT_LIBRARY” are commented out, as shown in this excerpt from the file:
// #define LOAD_SD_LIBRARY
// #define LOAD SFFAT_LIBRARY
4. Applying the patch files found at https://github.com/ambiot/ambd_arduino/tree/master/Ameba_misc/TensorFlowLite_patch by following the “readme.txt” under the same path.

Open the example, “Files” -> “Examples” -> “TensorFlowLite_Ameba” -> “person_detection”.

User can define the LED pins by using any GPIO pins on the boards.
Upload the code and press the reset button on the Ameba board once the upload has completed.
Once it is running, you should see the blue LED flashing every seconds, indicating that it has finished processing an image. The red LED will light up if it determines that there is no person in the previous image captured, and the green LED will light up if it will determines that there is a person.
The inference results are also output to the Arduino IDE serial monitor, which appears as follows:

Code Reference

More information on TensorFlow Lite for Microcontrollers can be found at: https://www.tensorflow.org/lite/microcontrollers.

Please confirm that QQ communication software is installed