How huaxiaozhong1/tensorflow-lite-apps-on-raspberry-pi-3 works
Main Components
• Docker Build Environment (Host):
• Ubuntu 18.04 host running a Docker container based on the tensorflow/tensorflow:1.12.0-devel image.
• Inside the container, note that the project uses a modified build setup: the new Makefile (found in the “make” folder) and additional source code under the “camera” directory (for camera image processing).
• Cross-compilation tool-chain installation (e.g., crossbuild-essential-armhf), which allows building for ARM targets.
• Downloading of TensorFlow Lite dependencies, and the building process that generates libtensorflow-lite.a and the demo executables.
• Static Libraries & External Dependencies:
• Static ARM libraries (from the “arm-linux-gnueabihf” directory) such as libjpeg.a, librt.a, and those for video4linux (libv4l* libraries). These libraries are copied from the Pi board (or provided in the repository) into the container.
• External dependencies (like libjpeg-dev and libv4l-dev) that are installed both in the container and on the Pi board.
• Demo Applications Components:
• Two demo apps: “camera” and “label_image” (source code in “camera” and “label_image” directories). The “camera” app includes functions for handling bitmap images (helpers and label integration) while “label_image” might be focused on running image classification.
• The “data” directory contains assets (an image, a labels file, and a mobilenet_v2 TFLite model) required by the apps.
• The “test” directory provides example logs from running these applications which helps indicate expected results.
• Raspberry Pi 3 Execution Environment:
• Raspberry Pi 3 board as a separate execution unit running Raspbian. On the board, the built executables along with the necessary assets (copied from the host’s container) are run.
• Attached camera and NFS setups used to share files between the host and board.
Architectural Patterns & Design Principles
• Separation of concerns:
• The build process (Docker container with TensorFlow Lite tools and modified Makefile) is entirely separate from the runtime environment (Raspberry Pi 3 board).
• The “camera” and “label_image” modules are modular demo apps which can be represented as distinct components that leverage the shared TensorFlow Lite library (libtensorflow-lite.a).
• That the system utilizes a cross-compilation pattern for embedded systems, with clear segregation between the host build environment and the target deployment environment.
Relevant Technologies & Frameworks
• Docker for containerized build environment,
• TensorFlow Lite (v1.12.0) as the underlying ML framework,
• Cross-compilation toolchain (crossbuild-essential-armhf),
• Libraries for image processing and camera handling (e.g., libjpeg, libv4l family),
• Raspbian OS on Raspberry Pi 3 as the target execution platform.