diff --git a/lite/examples/audio_classification/raspberry_pi/README.md b/lite/examples/audio_classification/raspberry_pi/README.md index 1c7080037cd..e64614b628d 100644 --- a/lite/examples/audio_classification/raspberry_pi/README.md +++ b/lite/examples/audio_classification/raspberry_pi/README.md @@ -16,6 +16,73 @@ with Raspberry Pi OS (preferably updated to Buster). Raspberry Pi doesn't have a microphone integrated on its board, so you need to plug in a USB microphone to record audio. + +## Setup Environment + +To ensure the TensorFlow Lite examples run smoothly on Raspberry Pi OS based on Debian Bookworm (2024 release), setting up a Python virtual environment is crucial. This setup guarantees compatibility with Python 3.9 and effectively manages the dependencies for your examples. + +### Install Python 3.9.0 + +Follow these steps to install Python from source: + +1. **Install Build Dependencies**: Begin by updating your system and installing the required packages: + ```bash + sudo apt update + sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget + ``` + +2. **Compile and Install Python**: Download, extract, and install Python: + ```bash + wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tar.xz + tar xf Python-3.9.0.tar.xz + cd Python-3.9.0 + ./configure --enable-optimizations --prefix=/usr + make -j $(nproc) + sudo make altinstall + ``` + +3. **Verify Python Installation**: Ensure Python 3.9.0 is installed successfully: + ```bash + python3.9 --version + ``` + +4. **Change Directory**: Move out of the Python source directory: + ```bash + cd .. + ``` + +### Optional: Cleanup After Installation + +To optimize disk space after the Python installation: + +1. **Remove Python Source Files**: Next, use `sudo` to remove the downloaded archive and the extracted Python source directory: + ```bash + sudo rm -rf Python-3.9.0.tar.xz Python-3.9.0 + ``` + +2. **Remove Build Dependencies**: Optionally, uninstall the build dependencies if they are no longer necessary: + ```bash + sudo apt remove --purge -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget + sudo apt autoremove -y + ``` + +### Virtual Environment Setup + +Prepare and activate a virtual environment for the TensorFlow Lite examples: + +1. **Create the Environment**: + ```bash + python3.9 -m venv /usr/local/venvs/tflite + ``` + +2. **Activate the Environment**: Always reactivate the virtual environment in new sessions: + ```bash + source /usr/local/venvs/tflite/bin/activate + ``` + +**Note**: Remember to reactivate the `tflite` environment with `/usr/local/venvs/tflite/bin/activate` each time you work on the TensorFlow Lite examples. + + ## Install the TensorFlow Lite runtime In this project, all you need from the TensorFlow Lite API is the `Interpreter` diff --git a/lite/examples/image_classification/raspberry_pi/README.md b/lite/examples/image_classification/raspberry_pi/README.md index d1c2b21151d..97fe22558db 100644 --- a/lite/examples/image_classification/raspberry_pi/README.md +++ b/lite/examples/image_classification/raspberry_pi/README.md @@ -24,6 +24,72 @@ to the Raspberry Pi. It's okay if you're using SSH to access the Pi shell attached to the Pi to see the camera stream. +## Setup Environment + +To ensure the TensorFlow Lite examples run smoothly on Raspberry Pi OS based on Debian Bookworm (2024 release), setting up a Python virtual environment is crucial. This setup guarantees compatibility with Python 3.9 and effectively manages the dependencies for your examples. + +### Install Python 3.9.0 + +Follow these steps to install Python from source: + +1. **Install Build Dependencies**: Begin by updating your system and installing the required packages: + ```bash + sudo apt update + sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget + ``` + +2. **Compile and Install Python**: Download, extract, and install Python: + ```bash + wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tar.xz + tar xf Python-3.9.0.tar.xz + cd Python-3.9.0 + ./configure --enable-optimizations --prefix=/usr + make -j $(nproc) + sudo make altinstall + ``` + +3. **Verify Python Installation**: Ensure Python 3.9.0 is installed successfully: + ```bash + python3.9 --version + ``` + +4. **Change Directory**: Move out of the Python source directory: + ```bash + cd .. + ``` + +### Optional: Cleanup After Installation + +To optimize disk space after the Python installation: + +1. **Remove Python Source Files**: Next, use `sudo` to remove the downloaded archive and the extracted Python source directory: + ```bash + sudo rm -rf Python-3.9.0.tar.xz Python-3.9.0 + ``` + +2. **Remove Build Dependencies**: Optionally, uninstall the build dependencies if they are no longer necessary: + ```bash + sudo apt remove --purge -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget + sudo apt autoremove -y + ``` + +### Virtual Environment Setup + +Prepare and activate a virtual environment for the TensorFlow Lite examples: + +1. **Create the Environment**: + ```bash + python3.9 -m venv /usr/local/venvs/tflite + ``` + +2. **Activate the Environment**: Always reactivate the virtual environment in new sessions: + ```bash + source /usr/local/venvs/tflite/bin/activate + ``` + +**Note**: Remember to reactivate the `tflite` environment with `/usr/local/venvs/tflite/bin/activate` each time you work on the TensorFlow Lite examples. + + ## Install the TensorFlow Lite runtime In this project, all you need from the TensorFlow Lite API is the `Interpreter` diff --git a/lite/examples/image_segmentation/raspberry_pi/README.md b/lite/examples/image_segmentation/raspberry_pi/README.md index 8303f857148..34f81e67f1c 100644 --- a/lite/examples/image_segmentation/raspberry_pi/README.md +++ b/lite/examples/image_segmentation/raspberry_pi/README.md @@ -23,6 +23,73 @@ Raspberry Pi. It's okay if you're using SSH to access the Pi shell (you don't need to use a keyboard connected to the Pi)—you only need a monitor attached to the Pi to see the camera stream. + +## Setup Environment + +To ensure the TensorFlow Lite examples run smoothly on Raspberry Pi OS based on Debian Bookworm (2024 release), setting up a Python virtual environment is crucial. This setup guarantees compatibility with Python 3.9 and effectively manages the dependencies for your examples. + +### Install Python 3.9.0 + +Follow these steps to install Python from source: + +1. **Install Build Dependencies**: Begin by updating your system and installing the required packages: + ```bash + sudo apt update + sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget + ``` + +2. **Compile and Install Python**: Download, extract, and install Python: + ```bash + wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tar.xz + tar xf Python-3.9.0.tar.xz + cd Python-3.9.0 + ./configure --enable-optimizations --prefix=/usr + make -j $(nproc) + sudo make altinstall + ``` + +3. **Verify Python Installation**: Ensure Python 3.9.0 is installed successfully: + ```bash + python3.9 --version + ``` + +4. **Change Directory**: Move out of the Python source directory: + ```bash + cd .. + ``` + +### Optional: Cleanup After Installation + +To optimize disk space after the Python installation: + +1. **Remove Python Source Files**: Next, use `sudo` to remove the downloaded archive and the extracted Python source directory: + ```bash + sudo rm -rf Python-3.9.0.tar.xz Python-3.9.0 + ``` + +2. **Remove Build Dependencies**: Optionally, uninstall the build dependencies if they are no longer necessary: + ```bash + sudo apt remove --purge -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget + sudo apt autoremove -y + ``` + +### Virtual Environment Setup + +Prepare and activate a virtual environment for the TensorFlow Lite examples: + +1. **Create the Environment**: + ```bash + python3.9 -m venv /usr/local/venvs/tflite + ``` + +2. **Activate the Environment**: Always reactivate the virtual environment in new sessions: + ```bash + source /usr/local/venvs/tflite/bin/activate + ``` + +**Note**: Remember to reactivate the `tflite` environment with `/usr/local/venvs/tflite/bin/activate` each time you work on the TensorFlow Lite examples. + + ## Install the TensorFlow Lite runtime In this project, all you need from the TensorFlow Lite API is the `Interpreter` diff --git a/lite/examples/object_detection/raspberry_pi/README.md b/lite/examples/object_detection/raspberry_pi/README.md index b2eae890494..bd7a1fff19e 100644 --- a/lite/examples/object_detection/raspberry_pi/README.md +++ b/lite/examples/object_detection/raspberry_pi/README.md @@ -24,6 +24,73 @@ Raspberry Pi. It's okay if you're using SSH to access the Pi shell (you don't need to use a keyboard connected to the Pi)—you only need a monitor attached to the Pi to see the camera stream. + +## Setup Environment + +To ensure the TensorFlow Lite examples run smoothly on Raspberry Pi OS based on Debian Bookworm (2024 release), setting up a Python virtual environment is crucial. This setup guarantees compatibility with Python 3.9 and effectively manages the dependencies for your examples. + +### Install Python 3.9.0 + +Follow these steps to install Python from source: + +1. **Install Build Dependencies**: Begin by updating your system and installing the required packages: + ```bash + sudo apt update + sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget + ``` + +2. **Compile and Install Python**: Download, extract, and install Python: + ```bash + wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tar.xz + tar xf Python-3.9.0.tar.xz + cd Python-3.9.0 + ./configure --enable-optimizations --prefix=/usr + make -j $(nproc) + sudo make altinstall + ``` + +3. **Verify Python Installation**: Ensure Python 3.9.0 is installed successfully: + ```bash + python3.9 --version + ``` + +4. **Change Directory**: Move out of the Python source directory: + ```bash + cd .. + ``` + +### Optional: Cleanup After Installation + +To optimize disk space after the Python installation: + +1. **Remove Python Source Files**: Next, use `sudo` to remove the downloaded archive and the extracted Python source directory: + ```bash + sudo rm -rf Python-3.9.0.tar.xz Python-3.9.0 + ``` + +2. **Remove Build Dependencies**: Optionally, uninstall the build dependencies if they are no longer necessary: + ```bash + sudo apt remove --purge -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget + sudo apt autoremove -y + ``` + +### Virtual Environment Setup + +Prepare and activate a virtual environment for the TensorFlow Lite examples: + +1. **Create the Environment**: + ```bash + python3.9 -m venv /usr/local/venvs/tflite + ``` + +2. **Activate the Environment**: Always reactivate the virtual environment in new sessions: + ```bash + source /usr/local/venvs/tflite/bin/activate + ``` + +**Note**: Remember to reactivate the `tflite` environment with `/usr/local/venvs/tflite/bin/activate` each time you work on the TensorFlow Lite examples. + + ## Download the example files First, clone this Git repo onto your Raspberry Pi like this: diff --git a/lite/examples/pose_estimation/raspberry_pi/README.md b/lite/examples/pose_estimation/raspberry_pi/README.md index c4c8c6d8842..adfcca60f14 100644 --- a/lite/examples/pose_estimation/raspberry_pi/README.md +++ b/lite/examples/pose_estimation/raspberry_pi/README.md @@ -16,6 +16,73 @@ This sample can run on Raspberry Pi or any computer that has a camera. It uses OpenCV to capture images from the camera and TensorFlow Lite to run inference on the input image. + +## Setup Environment + +To ensure the TensorFlow Lite examples run smoothly on Raspberry Pi OS based on Debian Bookworm (2024 release), setting up a Python virtual environment is crucial. This setup guarantees compatibility with Python 3.9 and effectively manages the dependencies for your examples. + +### Install Python 3.9.0 + +Follow these steps to install Python from source: + +1. **Install Build Dependencies**: Begin by updating your system and installing the required packages: + ```bash + sudo apt update + sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget + ``` + +2. **Compile and Install Python**: Download, extract, and install Python: + ```bash + wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tar.xz + tar xf Python-3.9.0.tar.xz + cd Python-3.9.0 + ./configure --enable-optimizations --prefix=/usr + make -j $(nproc) + sudo make altinstall + ``` + +3. **Verify Python Installation**: Ensure Python 3.9.0 is installed successfully: + ```bash + python3.9 --version + ``` + +4. **Change Directory**: Move out of the Python source directory: + ```bash + cd .. + ``` + +### Optional: Cleanup After Installation + +To optimize disk space after the Python installation: + +1. **Remove Python Source Files**: Next, use `sudo` to remove the downloaded archive and the extracted Python source directory: + ```bash + sudo rm -rf Python-3.9.0.tar.xz Python-3.9.0 + ``` + +2. **Remove Build Dependencies**: Optionally, uninstall the build dependencies if they are no longer necessary: + ```bash + sudo apt remove --purge -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget + sudo apt autoremove -y + ``` + +### Virtual Environment Setup + +Prepare and activate a virtual environment for the TensorFlow Lite examples: + +1. **Create the Environment**: + ```bash + python3.9 -m venv /usr/local/venvs/tflite + ``` + +2. **Activate the Environment**: Always reactivate the virtual environment in new sessions: + ```bash + source /usr/local/venvs/tflite/bin/activate + ``` + +**Note**: Remember to reactivate the `tflite` environment with `/usr/local/venvs/tflite/bin/activate` each time you work on the TensorFlow Lite examples. + + ## Install the dependencies * Run this script to install the Python dependencies, and download the TFLite diff --git a/lite/examples/sound_classification/raspberry_pi/README.md b/lite/examples/sound_classification/raspberry_pi/README.md index 82281791352..53b695832bc 100644 --- a/lite/examples/sound_classification/raspberry_pi/README.md +++ b/lite/examples/sound_classification/raspberry_pi/README.md @@ -16,6 +16,73 @@ with Raspberry Pi OS (preferably updated to Buster). Raspberry Pi doesn't have a microphone integrated on its board, so you need to plug in a USB microphone to record audio. + +## Setup Environment + +To ensure the TensorFlow Lite examples run smoothly on Raspberry Pi OS based on Debian Bookworm (2024 release), setting up a Python virtual environment is crucial. This setup guarantees compatibility with Python 3.9 and effectively manages the dependencies for your examples. + +### Install Python 3.9.0 + +Follow these steps to install Python from source: + +1. **Install Build Dependencies**: Begin by updating your system and installing the required packages: + ```bash + sudo apt update + sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget + ``` + +2. **Compile and Install Python**: Download, extract, and install Python: + ```bash + wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tar.xz + tar xf Python-3.9.0.tar.xz + cd Python-3.9.0 + ./configure --enable-optimizations --prefix=/usr + make -j $(nproc) + sudo make altinstall + ``` + +3. **Verify Python Installation**: Ensure Python 3.9.0 is installed successfully: + ```bash + python3.9 --version + ``` + +4. **Change Directory**: Move out of the Python source directory: + ```bash + cd .. + ``` + +### Optional: Cleanup After Installation + +To optimize disk space after the Python installation: + +1. **Remove Python Source Files**: Next, use `sudo` to remove the downloaded archive and the extracted Python source directory: + ```bash + sudo rm -rf Python-3.9.0.tar.xz Python-3.9.0 + ``` + +2. **Remove Build Dependencies**: Optionally, uninstall the build dependencies if they are no longer necessary: + ```bash + sudo apt remove --purge -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget + sudo apt autoremove -y + ``` + +### Virtual Environment Setup + +Prepare and activate a virtual environment for the TensorFlow Lite examples: + +1. **Create the Environment**: + ```bash + python3.9 -m venv /usr/local/venvs/tflite + ``` + +2. **Activate the Environment**: Always reactivate the virtual environment in new sessions: + ```bash + source /usr/local/venvs/tflite/bin/activate + ``` + +**Note**: Remember to reactivate the `tflite` environment with `/usr/local/venvs/tflite/bin/activate` each time you work on the TensorFlow Lite examples. + + ## Install the TensorFlow Lite runtime In this project, all you need from the TensorFlow Lite API is the `Interpreter` diff --git a/lite/examples/video_classification/raspberry_pi/README.md b/lite/examples/video_classification/raspberry_pi/README.md index e7b6175bc20..716da8bbfcc 100644 --- a/lite/examples/video_classification/raspberry_pi/README.md +++ b/lite/examples/video_classification/raspberry_pi/README.md @@ -20,6 +20,73 @@ Raspberry Pi. It's okay if you're using SSH to access the Pi shell (you don't need to use a keyboard connected to the Pi)—you only need a monitor attached to the Pi to see the camera stream. + +## Setup Environment + +To ensure the TensorFlow Lite examples run smoothly on Raspberry Pi OS based on Debian Bookworm (2024 release), setting up a Python virtual environment is crucial. This setup guarantees compatibility with Python 3.9 and effectively manages the dependencies for your examples. + +### Install Python 3.9.0 + +Follow these steps to install Python from source: + +1. **Install Build Dependencies**: Begin by updating your system and installing the required packages: + ```bash + sudo apt update + sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget + ``` + +2. **Compile and Install Python**: Download, extract, and install Python: + ```bash + wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tar.xz + tar xf Python-3.9.0.tar.xz + cd Python-3.9.0 + ./configure --enable-optimizations --prefix=/usr + make -j $(nproc) + sudo make altinstall + ``` + +3. **Verify Python Installation**: Ensure Python 3.9.0 is installed successfully: + ```bash + python3.9 --version + ``` + +4. **Change Directory**: Move out of the Python source directory: + ```bash + cd .. + ``` + +### Optional: Cleanup After Installation + +To optimize disk space after the Python installation: + +1. **Remove Python Source Files**: Next, use `sudo` to remove the downloaded archive and the extracted Python source directory: + ```bash + sudo rm -rf Python-3.9.0.tar.xz Python-3.9.0 + ``` + +2. **Remove Build Dependencies**: Optionally, uninstall the build dependencies if they are no longer necessary: + ```bash + sudo apt remove --purge -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget + sudo apt autoremove -y + ``` + +### Virtual Environment Setup + +Prepare and activate a virtual environment for the TensorFlow Lite examples: + +1. **Create the Environment**: + ```bash + python3.9 -m venv /usr/local/venvs/tflite + ``` + +2. **Activate the Environment**: Always reactivate the virtual environment in new sessions: + ```bash + source /usr/local/venvs/tflite/bin/activate + ``` + +**Note**: Remember to reactivate the `tflite` environment with `/usr/local/venvs/tflite/bin/activate` each time you work on the TensorFlow Lite examples. + + ## Install the TensorFlow Lite runtime In this project, all you need from the TensorFlow Lite API is the `Interpreter`